[Haskell-cafe] how to implement daemon start and stop directives?

Krzysztof Skrzętnicki gtener at gmail.com
Sun Jan 25 06:57:56 EST 2009

When you succeed please write about it - I'd love to read about it!I was
interested in writing a deamon in the past but didn't have time for it and a
nice tutorial would probably help a lot.

All best

Christopher Skrzętnicki

On Sun, Jan 25, 2009 at 02:57, Belka <lambda-belka at yandex.ru> wrote:

> >If you want a normal daemon, you want to look at System.Posix.Process
> >to create a proper daemon (forkProcess, createSession; don't forget to
> >close stdOutput (and, errr, Haskell library types:  stdin and stderr
> >are where?  not System.Posix.IO with stdOutput) and reopen them on /
> >dev/null, at least if they're ttys as determined by
> >System.Posix.Terminal.queryTerminal).  You also want to write out a
> >pidfile (/var/run/programname.pid) for use by startproc / killproc,
> >and you want to install a handler for sigTERM
> >(System.Posix.Signals.installHandler) which sets the exit flag (TVar,
> >MVar, IORef, Chan, take your pick).  Ideally you also catch sigHUP and
> >reload your state.
> Thanks for the guide, Brandon !!
> By the way, I found a piece of code with function (daemonize :: IO () -> IO
> ()) (http://sneakymustard.com/2008/12/11/haskell-daemons), which is close
> to
> the subject.
> I guess now I'm ready to implement my own daemon!
> Thanks for your help, everyboby!! =)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090125/fb8f6012/attachment.htm

More information about the Haskell-Cafe mailing list