You may want to look at Apache2::SubProcess.

Basically you just need to

use POSIX 'setsid'

(thats what Proc::Daemon uses too).

just dont forget to detach stdin/stdout/stderr, and chdir '/' in the
daemonized process to avoid problems.

Enno


On Fri, 6 Jan 2006, Jens Gassmann wrote:

> Hi,
>
> 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?
>
>
> Jens
>
>
>
>
>
>
>

Reply via email to