[Python-ideas] Draft PEP (version 0.4): Standard daemon process library

Antoine Pitrou solipsis at pitrou.net
Thu Jan 29 17:54:53 CET 2009


> `files_preserve`
>     :Default: ``None``
>     List of files that should *not* be closed when starting the
>     daemon.

Why does it have to be explicit? If I have an open file lying around, it
should be obvious that I don't want it closed. Otherwise I'd have closed it
The exception is of course the three stdio streams, which should be treated

> `umask`
>     :Default: ``0``
>     File access creation mask (“umask”) to set for the process on
>     daemon start.
>     Since a process inherits its umask from its parent process,
>     starting the daemon will reset the umask to this value so that
>     files are created by the daemon with access modes as it expects.

Why this behaviour? It's easy enough to call os.umask() manually if you want it,
but there are certainly situations where you don't want to change the
umask (situations where the daemon is meant to act on behalf of the user who
started it).
Or, perhaps, umask could be made mand

(regardless of which, 0 isn't a sensible umask default!)

>     * If the `pidfile_directory` attribute is not ``None``:
>       * Look in that directory for a file named '`pidfile_name`.pid';
>         if it exists, raise a `DaemonError` to prevent multiple
>         instances of the daemon process.

It should first check that there does exist a processus with that number, so
that stale pid files don't cause too many problems.



More information about the Python-ideas mailing list