|Problems? Is your data what you think it is?
Re: Detached forking in a CGI scriptby flexvault (Monsignor)
|on Apr 29, 2016 at 18:22 UTC
A few years back and this process was easy, but today many of the web servers will not allow children to continue to run if the parent exits. I've gotten around this by using a continuous running Perl script that keeps checking a file for instructions on work to be passed to new forked script.
The cgi script locks the file, adds the work to be done to that file, and then closes (which unlocks also) the file and exits.
The continuous running script sees the new work and forks to do the required work. (Note: You can also use 'pre-forked' scripts to do this.)
Possibly the referenced module does something similar and may give a more complete solution than using your own 'fork'. Just because it uses 'fork' and 'exec' doesn't mean that there isn't a whole lot more logic necessary to provide independent processes to complete the work after the parent cgi script exits. YMMV
"Well done is better than well said." - Benjamin Franklin