PEP 3143: Standard daemon process library (was: Writing a well-behaved daemon)

Floris Bruynooghe floris.bruynooghe at gmail.com
Fri Mar 20 16:47:47 CET 2009


On Mar 20, 9:58 am, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> Ben Finney <b... at benfinney.id.au> writes:
> > Writing a Python program to become a Unix daemon is relatively
> > well-documented: there's a recipe for detaching the process and
> > running in its own process group. However, there's much more to a
> > Unix daemon than simply detaching.
>
> […]
>
> > My searches for such functionality haven't borne much fruit though.
> > Apart from scattered recipes, none of which cover all the essentials
> > (let alone the optional features) of 'daemon', I can't find anything
> > that could be relied upon. This is surprising, since I'd expect this
> > in Python's standard library.
>
> I've submitted PEP 3143 <URL:http://www.python.org/dev/peps/pep-3143/>
> to meet this need, and have re-worked an existing library into a new
> ‘python-daemon’ <URL:http://pypi.python.org/pypi/python-daemon/>
> library, the reference implementation.
>
> Now I need wider testing and scrutiny of the implementation and
> specification.

Had a quick look at the PEP and it looks very nice IMHO.

One of the things that might be interesting is keeping file
descriptors from the logging module open by default.  So that you can
setup your loggers before you daemonise --I do this so that I can
complain on stdout if that gives trouble-- and are still able to use
them once you've daemonised.  I haven't looked at how feasable this is
yet so it might be difficult, but useful anyway.


Regards
Floris



More information about the Python-list mailing list