Dear helpful readers...
What is the best practice for handling daemons and server processes? Does anyone know of good documentation on this? Especially considering that otherwise "good" software often is crappy at handling this part?
paster serve is, in effect, a little application server. It has a --daemon option and other options. I try to make them nice, but things trip me up.
Like, I enter daemon mode, then typically bind to a port. If something else is already being served up, the startup fails. I might clobber their PID file. The startup script appears to function, because it exits from the master process, not the daemon process, and the master process exited just fine. How should I deal with this stuff? I'd like to stick to Python, and not use other programs (like start-stop-daemon or whatnot), but I'd also like to know how those programs work -- what they call, in what order, with what protections, etc. And which one of the many options out there is best to emulate. All just for Posix, of course -- it's a whole different situation on Windows.