
Sterling, Gregory, Brandon and David thanks for your suggestions.
On 6 March 2011 05:38, David Anderson
I humbly recommend doing such daemonizations from outside your program. Programs that daemonize on startup make it very difficult to monitor them by direct means, instead forcing you to rely on PID files and other mechanisms which may not always be available or fresh.
Agreed, I already noticed that debugging is a bit harder since I have no stdout and stderr anymore.
For reference, Upstart, the new PID 1 on Ubuntu and friends, has a horrible hack[1] built in specifically to keep track of processes that "helpfully" daemonize themselves, so that it can offer additional services like restarting crashed services or notifying the owner of a problem. As has been pointed out elsewhere on thread, there are plenty of standalone programs that implement daemonization if you end up not using service management software to do it for you.
I plan to run the daemon on a Ubuntu server. Do you know if Upstart is able to daemonize a process? Regards, Bas