redirecting sdtout/sdterr in a daemon
Graham Ashton
graz at mindless.com
Wed Oct 31 05:08:17 EST 2001
In article <9rmiqc$23hq at r02n01.cac.psu.edu>, "Rajarshi Guha"
<rxg218 at psu.edu> wrote:
> I'm using the daemonize.py module to make my code run as a daemon.
> However the module contains the lines:
>
> sys.stdout = NullDevice()
> sys.stderr = NullDevice()
I've got a library of classes that do a similar thing (in pretty much the
same way), based on a snippet of code in Fredrik Lundh's "Python Standard
Library". It can optionally write to syslog too as well as a plain file.
You can find it here (you want gmalib):
http://sourceforge.net/project/showfiles.php?group_id=34228
Have a look at the code for the Daemon.daemonise() method to see how it
works. The best example usage is in the landiallerd package (same web
page).
--
Graham
More information about the Python-list
mailing list