You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Cameron B. Prince" <cp...@rideware.com> on 2003/09/12 16:33:09 UTC
Forking
Hi all,
I have an Embperl page that uses a custom module which has code that calls
an external perl script via fork. This script takes a considerable amount of
time to run and I need it to just run in the background. I've gotten it to
work but I'm noticing that I've got zombies once the processes complete
until I restart Apache.
Here's the code:
my $pid;
unless ($pid = fork) {
local($SIG{HUP}) = 'IGNORE';
local($SIG{USR1}) = 'IGNORE';
local($SIG{USR2}) = 'IGNORE';
exec $command;
die "no exec";
exit 0;
}
Am I missing a signal or something to run this command as an entirely
stand-alone process?
Thanks,
Cameron
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Forking
Posted by Neil Gunton <ne...@nilspace.com>.
"Cameron B. Prince" wrote:
>
> Hi all,
>
> I have an Embperl page that uses a custom module which has code that calls
> an external perl script via fork. This script takes a considerable amount of
> time to run and I need it to just run in the background. I've gotten it to
> work but I'm noticing that I've got zombies once the processes complete
> until I restart Apache.
>
> Here's the code:
>
> my $pid;
>
> unless ($pid = fork) {
> local($SIG{HUP}) = 'IGNORE';
> local($SIG{USR1}) = 'IGNORE';
> local($SIG{USR2}) = 'IGNORE';
> exec $command;
> die "no exec";
> exit 0;
> }
>
> Am I missing a signal or something to run this command as an entirely
> stand-alone process?
This document talks about the correct way to fork from mod_perl:
http://perl.apache.org/docs/1.0/guide/performance.html#Forking_and_Executing_Subprocesses_from_mod_perl
Hope this helps...
/Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org