On Thu, 21 Dec 2000, Kees Vonk 7249 24549 wrote:

> > Below is a solution to this problem:
> > 
> > * fork the long running process from mod_perl
> > * and be able to restart the server 
> >    o without killing this process 
> >    o without this process keeping the socket busy 
> >      and thus preventing the server restart
> > 
[snip]
> >   defined (my $kid = fork) or die "Cannot fork: $!\n";
> >   if ($kid) {
> >     print "Parent $$ has finished, kid's PID: $kid\n";
> >   } else {
> >       $r->cleanup_after_fork();
> >       chdir '/'                or die "Can't chdir to /: $!";
[snip]

> Thank you very much, that works great and it looks much neater than what 
> I had before.

thanks goes to doug for cleanup_after_fork :) BTW, in the official release
it'll be called cleanup_for_exec(), so you better use this one from the
beginning.

> BTW. what is the function of the chdir '/', is that needed or can I 
> leave that out?

it's useful in case you decide to umount the partition later, see perlipc
manpage. You can leave it out of course.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/  


Reply via email to