Python daemon class
Written by David Mytton
Our server monitoring agent has always run as a daemon on Unix, Linux and OS X because you want it to just work and not be messing with background tasks or cron jobs. This was achieved using a modified version of a daemonizing class I found online (before the pypi python-daemon package existed, although I had some problems when trying it anyway).
The agent is released under the FreeBSD open source license so you could extract the daemon class for your own uses if you wished, but I’ve spent a little time extracting it into its own Github project with some documentation to make that a little easier.
So if you need a way to daemonize your Python scripts which handles start, stop, restart, foreground debugging and PID management on Unix, Linux and OS X that has been tested in production for several years and is actively maintained, now you can!
View python-daemon on Github and feel free to push back any improvements.