Hello,

our CMS create sometimes long runnig tasks. This Tasks we start with the
following code:

`/usr/bin/perl  -e 'use Modul; Modul->function($arg);' > /dev/null &`;

This works. Apache returns the html-page and the long running function
goes into the background. But if we restart Apache all childs and our
long running function was killed :-(

Could i daemonize the long running process to be sure that he wasn't
killed by a apache restart? Maybe with Proc::Daemon.

Is the a good solution or somebody knows a better way to do it?


use Acme::Spork;

my $spork_pid = spork(\&long_running_proc, @args) or die "could not fork for spork: $!";

Its "Acme" but its hardcore awesome and useful. (could prolly be in Proc:: with a more "professional" name, but "Spork" is pretty much a fun name (but fitting no?) which is why its in Acme)

I've never used it in mod_perl but I imagine it should work just fine including the children :)

It also has daemonize funtion that is a shortcut for Proc::Daemon's Init if you truly want to daemonize the script at that point, but it doesn't sound like that is what you want.

HTH :)

Reply via email to