Ethan Furman <et...@stoneleaf.us> writes: > On 03/04/2017 09:09 PM, Ian Pilcher wrote: > > > Is it possible to get python-daemon to create "systemd style" PID > > file?
Short answer: No, that's the job of whatever ‘pidfile’ object you provide. Medium answer: Yes, by implementing that behaviour in the object you choose to present as the ‘pidfile’ option. The ‘python-lockfile’ library is suggested as one implementation, but there are of course others. Longer answer: Because ‘python-daemon’ is deliberately agnostic about what the ‘pidfile’ object does, you can give it any behaviour you like. The only thing the ‘DaemonContext.pidfile’ option is expected to do is be a context manager; what happens when that context manager is entered or exited is up to you. > 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. It certainly allows it: put whatever behaviour your application needs in the context manager's methods. More about writing a context manager can be found at the documentation <URL:https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers>. -- \ “If we listen only to those who are like us, we will squander | `\ the great opportunity before us: To live together peacefully in | _o__) a world of unresolved differences.” —David Weinberger | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list