martino has asked for the wisdom of the Perl Monks concerning the following question:
I have a cgi script run from a web browser which should allow the user to start a background process. The background process will run indefinitely (it's responsible for detecting files and processing them, sleeping for a period of time then starting over again) so i want to be able to start the process with no waits and return control to the cgi script.
I've tried system("perl script.pl &"), fork/exec "perl script.pl" and open (CMDLOG,"| $cmd") all to no avail. They all run the script okay but they all wait for it to complete before returning control to parent cgi.
By the way this is all running under Linux if that has any bearing.
Any suggestions would be greatly appreciated. I'd prefer to use core Perl functionality if at all possible. Use of anything else would require approval which i really need to avoid. Thanks, M.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fork/exe, system open etc.
by moritz (Cardinal) on May 02, 2008 at 12:57 UTC | |
|
Re: fork/exe, system open etc.
by zentara (Cardinal) on May 02, 2008 at 13:25 UTC | |
|
Re: fork/exe, system open etc.
by mscharrer (Hermit) on May 02, 2008 at 13:19 UTC | |
|
Re: fork/exe, system open etc.
by almut (Canon) on May 02, 2008 at 13:54 UTC | |
by pc88mxer (Vicar) on May 02, 2008 at 19:28 UTC | |
by almut (Canon) on May 02, 2008 at 20:04 UTC | |
by martino (Initiate) on May 06, 2008 at 08:09 UTC |