chicken-users
[Top][All Lists]
Advanced

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

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


From: Ozzi
Subject: [Chicken-users] daemonize egg: redirect I/O?
Date: Thu, 25 Oct 2007 10:28:12 -0500
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

I am working on for creating unix daemons. Can anyone tell me how to redirect stdout and stderr? I want to redirect them to /dev/null by default.

I would also be interested in comments on my plans for the egg in general. Presently, the interface is as follows:

daemonize is a function that takes a "daemon" proc of one argument, that argument being a "cleanup" proc which the "daemon" proc should call before it exits.

In addition, daemonize will take a number of keyword arguments, including stdout:, stderr:, and pidfile:. stdout and stderr are simply where to redirect those outputs to. pidfile is the name of the file that the daemon should keep it's PID in.

For a silly example:

(daeamonize
 (lambda (cleanup)
   (sleep 10)
   (cleanup))
 pidfile: "/tmp/my.pid")

Will fork a new process and create the file "/tmp/my.pid" with the PID of the process. The new process will sleep for 10 seconds, then call the cleanup proc, which deletes the PID file.

Let me know what you think, and if you have any other ideas or suggestions.

Ozzi




reply via email to

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