Running python as a deamon (rfork)

henk_p at my-deja.com henk_p at my-deja.com
Mon Oct 11 07:33:03 EDT 1999


Hi Y'all,

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.
I already hacked python's main.c file to recognize a new -b startup
parameter. In this code I do a POSIX rfork(NOWAIT) when the -b parameter
is processed. The parent process returns to the shell, the
child process will continue in the background.
now you can do:

python -b loopd.py

And loopd keeps on running forever, and python returns its PID to the
shell.

It would also be possible to do this in a module, but the POSIX module
does not export the rfork function.
Can somebody tell me why rfork() is not included in the posix module?.






Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list