Example of signaling and creating a python daemon

Diez B. Roggisch deets at nospam.web.de
Sun Sep 25 15:55:36 CEST 2005

Jon Monteleone wrote:
> What I dont understand about daemonizing a python script is whether or not it requires the
> daemon creation, ie the signal handling and forking of the process, to be part of the
> daemon code or is this code in a separate program that acts like a wrapper to turn a
> python program into a daemon.  The latter is how linux documentation describes turning a
> program into a daemon.
> I guess I am wondering about the difference between using python to daemonize a program vs
> using a bash script to daemonize a program.

There is no difference in that. Daemonizing means detaching a process 
from the invoking process and making it a child to init, together with 
some other stuff. That's your first case and that's what daemonizing is 

Now if the process then "transforms" itself to another one - like with 
os.execvpe - that has nothing to say. And it's the way the bash-thingy 
works, using some daemonize-command that exactly does that.


More information about the Python-list mailing list