[Zope-Coders] extra-clean shutdown, signal handling

Guido van Rossum guido@python.org
Wed, 30 Oct 2002 12:02:47 -0500


> >>>This ended up writing the child process's pid to the pid_file, rather
> >>>than the zdaemon process manager's pid.  Does anyone understand why
> >>>zdaemon does fork+fork+exec rather than just fork+fork?
> 
> This may have been answered already but ... typically a dual fork is 
> used to get a new process group id. It is a very old convention, and I 
> dont know that zdaemon is even doing it right.  Now you typically see a 
> fork() setpgrp() fork() exec() or similar.   The whole intent is to 
> disassociate yourself from your parent and become a daemon.

I agree with the double fork.  I'm just questioning the wisdom of
doing a re-exec of the program in the grandchild.

--Guido van Rossum (home page: http://www.python.org/~guido/)