Whew, now that that's out of the way, let's get down to business. You're here because you're looking for documentation on how to write a daemon in Python. Stop! Look no further! Turn a blind eye! Just use this library to do the dumb, idiotic, yet necessary things to make a stable daemon for your Python program!
The basic idea is that write your program so that it can be started by calling one function, say main(). Then you would do the following:
import daemonize def the_other_main_that_calls_the_main_function(sys.argv): # Parse command line options, all that jazz... # Time to start your daemon! daemonize.start(main) # Wow, that was hard... Time to do... uh... umm... exit? # Ahh, I know, get beer from fridge! Yeah, that's it!
You might think that this would be easy to do on your own, and you'd be correct. It's easy. But dumb. I see daemons written incorrectly all the time, because it's a dumb set of things that you shouldn't have to worry about. Do yourself a favor and use this library instead.
Still looking for documentation? My, you're a pesky one, aren't you? Well, here is how to write a daemon.
Oooo, now you're a smarty pants aren't you? :) Well, call daemonize.start() again if you have to. And again. And again. Have you ever tried to see how many daemons your system can run before they start getting killed by the OS? :) (Hint: Your system gets *really* slow!)
Above all, have fun, and may all your daemons be stable!
Bored with no more plants left to water? Drop us an email on the mailing list, or post a message on the forum.