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

Ben Finney ben+python at benfinney.id.au
Fri Mar 20 05:58:58 EDT 2009


Ben Finney <ben 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.

One point to note: This is only intended to address the task of a
program transforming *itself* into a daemon process. If you want to
spawn off *extra* processes and manage them through a “service”
channel, you want something this spec was never meant to cover. You
may be interested in discussing that further on a separate thread at
<URL:http://mail.python.org/pipermail/python-ideas/2009-January/002606.html>.


If you want to turn your program into a well-behaved daemon process,
I'd like to know how well PEP 3143 works for you. Please try it out
for your daemon programs and discuss!

-- 
 \            “The whole area of [treating source code as intellectual |
  `\    property] is almost assuring a customer that you are not going |
_o__)               to do any innovation in the future.” —Gary Barnett |
Ben Finney



More information about the Python-list mailing list