perl cgi script doesn't finish after calling system command 
Author Message
 perl cgi script doesn't finish after calling system command

I have a perl cgi script which calls a shell script on the server which
starts up a java program as a background process. This works OK and the java
server which is run works fine and appears opposite the applet which is
loaded on the browser. The only problem is that the page never finishes
downloading and therefore after a while, the correct page disappears and a
message appears saying that the page cannot load.

This is quite annoying as it is clear that the page has loaded. What is the
reasoning for this? Is the perl script still waiting for the background java
process to finish?? How can I get around this? I thought of using a fork to
start the java server as a background child process. Is this advisable?

To be of help, below are the snippets of code which perform the tasks

CGI script:
-----------
    $parameters = "$matchid";
    system('/u1/cs4/ceegt1/www/callserver', $parameters);

Shell Script
------------
#!/bin/sh
cd /u1/cs4/ceegt1/www
java CommentaryServer $1 >>/u1/cs4/ceegt1/www/logfile &

If anyone can help, I would be very grateful

Thanks

Gary



Tue, 26 Aug 2003 02:09:03 GMT  
 perl cgi script doesn't finish after calling system command

Quote:
> This is quite annoying as it is clear that the page has loaded. What is
the
> reasoning for this? Is the perl script still waiting for the background
java
> process to finish?? How can I get around this? I thought of using a fork
to
> start the java server as a background child process. Is this advisable?

system in perl waits for the called process to finish.  If the system call
is the last thing you do in the perl script you can use exec.  Although I
have never used it I understand that exec does not return from the system
call (Ie.  Perl script is terminated after the exec process is successfully
started).  If you fork the java server, wouldn't you still have the same
problem?  I am not sure.


Tue, 26 Aug 2003 02:25:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. PROBLEM: cgi doesn't wait for perl process to finish - times out

2. CGI::Push doesn't Finish

3. Script doesn't always finish

4. Calling system command from CGI script

5. problem calling 'system' command

6. System command doesn't return on NT

7. system command doesn't work

8. system() doesn't find internal commands

9. System call doesn't do what I want

10. System call doesn't work right!

11. System call doesn't do what I want

12. DBD::Oracle: finish doesn't free resources

 

 
Powered by phpBB® Forum Software