the dreaded double fork

Doug Holton insert at spam.here
Thu May 6 10:50:47 EDT 2004


John Hunter wrote:

> I am using python to run an xml rpc daemon using SimpleXMLRPCServer.
> Following a cookbook recipe, I am trying to do a double fork so that
> when I exit the shell the daemon remains running.  But it doesn't.
> Here is how I start the script
> 
> 
>>ssh somehost
>>sudo python mydaemon start&

See also http://www.noah.org/python/daemonize.py

But another way to do it without needing nohup or daemonize is to double 
background it and redirect stdout and stderr:

(python mydaemon start > /dev/null 2>&1 & ) &

Then you can exit and it will still be running (check ps -A to see it).



More information about the Python-list mailing list