[Melbourne-pm] Testing fork
Jonathon Padfield
jpadfield at hotkey.net.au
Tue Aug 24 17:46:27 CDT 2004
On Tue, 24 Aug 2004 07:56 pm, David Dick wrote:
> i've got a cgi-script that needs to accept a job from a user, return a
> 202 and point the user to a url that they can use to monitor the job's
> status.
>
> Now, to kick off a job, the best way that i can think of is to partially
> daemonize (i don't want to close STDERR for example) and run the job in
> the partial daemon, while the original cgi process returns the pointer
> to the user.
>
> 3) probably a whole lot of other issues that i'm not aware of yet.
You've also got issues as to what user & permissions the script runs as
(apache / root?), what directories it's limited to, etc.
I had a similar situation in the past, but instead of forking the secondary
process directly, I wrote a second daemon that simply kept scanning a
directory for instructions left in files created by the webserver. When a new
job was detected, it'd spawn off a new process.
Now I'd probably achieve the same result using a database, and keep more
information about the new processes, such as PID's, start time, exit code,
etc.
-Jon
--
Jonathon Padfield
Software Engineer Hotkey Internet Services
More information about the Melbourne-pm
mailing list