Writing a simple linux daemon type thing...

Steve Holden sholden at holdenweb.com
Tue Jun 18 13:50:53 CEST 2002


"Michael Gilfix" <mgilfix at eecs.tufts.edu> wrote ...
>   Wouldn't it be nice if some daemonizing code and basic log support
> was built into SocketServer? SocketServer aims at simplifying
> the infrastructure for people who don't need a full-blown server
> app. Might also be a nice addition for smaller projects who don't want
> to deal with this sort of thing... Might make an interesting patch
> IMHO.
>

That wouldn't be quite such a good idea as it sounds. The SocketServer code
is only really intended as a demonstration of basic techniques, and
certainly hasn't been coded as industrial-strength. There would probably be
aa lot more work in the patch than you anticipate.

Any daemon process needs to ensure it

1. Detaches from its controlling terminal, using safe alternatives to stdout
and stderr, and

2. Creates a new process group so it is invulnerable to signals received by
the triggering process.

SocketServer and their derivatives don't do either of these things IIRC

regards
--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list