python-daemon and PID files

Chris Angelico rosuav at gmail.com
Sun Mar 5 00:14:58 EST 2017


On Sun, Mar 5, 2017 at 4:09 PM, Ian Pilcher <arequipeno at gmail.com> wrote:
> Is it possible to get python-daemon to create "systemd style" PID file?
>
> I.e., systemd wants a daemon to write a file with a specific name that
> *contains* the PID of the child process.  python-daemon, OTOH, seems to
> use its pidfile parameter as more of a lock file.
>
> Currently, I'm creating my PID file manually in the child process, but
> systemd complains, because it wants the PID file to exist before the
> parent exits.

Why do you need a pidfile? When I get systemd to start a process, I
just have it not fork. Much easier. Forget about python-daemon - just
run your script in the simple and straight-forward way.

(Possibly that'll mean having it do different things depending on
whether it's started from systemd or some other way, but that can be
controlled with a parameter.)

ChrisA


More information about the Python-list mailing list