When you succeed please write about it - I'd love to read about it!<div>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.<br><div><br></div>
<div>All best</div><div><br></div><div>Christopher Skrzętnicki<br><br><div class="gmail_quote">On Sun, Jan 25, 2009 at 02:57, Belka <span dir="ltr"><<a href="mailto:lambda-belka@yandex.ru">lambda-belka@yandex.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d"><br>
>If you want a normal daemon, you want to look at System.Posix.Process<br>
>to create a proper daemon (forkProcess, createSession; don't forget to<br>
>close stdOutput (and, errr, Haskell library types: stdin and stderr<br>
>are where? not <a href="http://System.Posix.IO" target="_blank">System.Posix.IO</a> with stdOutput) and reopen them on /<br>
>dev/null, at least if they're ttys as determined by<br>
>System.Posix.Terminal.queryTerminal). You also want to write out a<br>
>pidfile (/var/run/programname.pid) for use by startproc / killproc,<br>
>and you want to install a handler for sigTERM<br>
>(System.Posix.Signals.installHandler) which sets the exit flag (TVar,<br>
>MVar, IORef, Chan, take your pick). Ideally you also catch sigHUP and<br>
>reload your state.<br>
<br>
</div>Thanks for the guide, Brandon !!<br>
<br>
By the way, I found a piece of code with function (daemonize :: IO () -> IO<br>
()) (<a href="http://sneakymustard.com/2008/12/11/haskell-daemons" target="_blank">http://sneakymustard.com/2008/12/11/haskell-daemons</a>), which is close to<br>
the subject.<br>
<br>
I guess now I'm ready to implement my own daemon!<br>
Thanks for your help, everyboby!! =)</blockquote><div> </div></div></div></div>