[Haskell-cafe] How to daemonize a threaded Haskell program?

Bas van Dijk v.dijk.bas at gmail.com
Mon Mar 7 09:39:59 CET 2011


Sterling, Gregory, Brandon and David thanks for your suggestions.

On 6 March 2011 05:38, David Anderson <dave at natulte.net> wrote:
> 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



More information about the Haskell-Cafe mailing list