Running python as a deamon (rfork)

Carey Evans c.evans at clear.net.nz
Tue Oct 12 04:06:15 EDT 1999


henk_p at my-deja.com writes:

> I want to run the python interpreter as a deamon process. So when
> I exit the shell it started from it keeps on running in the background.
> I know this is possible under unix by using the nohup command, but
> that is not a very nice solution.

You can write a daemon under Python just the same as in C.  The
attached module is a bit simplistic in places, but it *does* turn
itself into a daemon properly.  It also shows how easy it is to use
SocketServer, which I hadn't tried until a few minutes ago.

If you run this program, it will put itself into the background, and
answer requests on port 2001 with the same answer as the normal
daytime server on port 13.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: daytime.py
URL: <http://mail.python.org/pipermail/python-list/attachments/19991012/df2ce0bb/attachment.ksh>
-------------- next part --------------

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	       "This is where your sanity gives in..."


More information about the Python-list mailing list