Python Process that can survive

Geert-Jan Van den Bogaerde gvdbogae at
Fri Sep 27 16:40:59 EDT 2002

On Fri, 2002-09-27 at 21:11, Christopher Peery wrote:
> Yeah I found this hack on the web and I can't believe that this is
> only way to do this in python. You're basically stripping the process
> of all it's stream and sending it on its way. This is really messy.

This is the standard way of daemonizing a process under UNIX, copied
(and translated to Python) from W. Richard Stevens' Advanced Programming
in the UNIX Environment. I don't see what's so messy about it.

Why do you care if the standard input, output and error streams are
closed? Since you're closing the terminal they're writing to and reading
from, they're useless anyway. You can reopen them after daemonizing to
redirect them to a file or some other stream, if you want.

Geert-Jan Van den Bogaerde

More information about the Python-list mailing list