chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] daemonize egg: redirect I/O?


From: Ozzi
Subject: Re: [Chicken-users] daemonize egg: redirect I/O?
Date: Fri, 26 Oct 2007 11:54:47 -0500
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Thomas Christian Chust wrote:

I wonder why one would want to pass this cleanup argument to the daemon
procedure -- why should the spawned process simply perform cleanup once
the daemon procedure returns?

The problem with that, as I see it, is that sometimes daemons don't get to return normally, i.e. if they get killed. Of course any proper daemon will implement signal handlers and such so that it will clean up after itself and exit gracefully. With my implementation you can implement that sort of stuff anyway you like, and just call the additional (cleanup) proc to take care of whatever you had daemonize set up for you, i.e. the PID file.

Of course, it might be nice to have daemonize take care of everything, including signal handlers and such. I would see that as a further abstraction.

(define (super-daemonize proc)
  (daemonize (lambda (cleanup)
               (set-signal-handler! ...) ; Call cleanup if we get killed.
               (proc)
               (cleanup))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]