python-daemon and PID files

Ethan Furman ethan at stoneleaf.us
Sun Mar 5 00:39:52 EST 2017


On 03/04/2017 09:09 PM, Ian Pilcher 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.

I know my library, pandaemonium [1], will allow you to write the pid file complete with the daemon's PID, and I would be 
very surprised if Ben's python-daemon did not also allow that.

Maybe it's just a timing issue -- have you tried having the parent process wait a few seconds to verify the file has 
been created and has the PID before exiting?

--
~Ethan~

[1] https://pypi.python.org/pypi/pandaemonium



More information about the Python-list mailing list