Running python as a deamon (rfork)
M.-A. Lemburg
mal at lemburg.com
Mon Oct 11 17:17:01 EDT 1999
henk_p at my-deja.com wrote:
>
> 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.
You can use one of the many daemonize functions that have been posted
to this list. dejanews will probably bring up a whole bunch of them.
> 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?.
Can't find it on Linux ... are you sure about it being POSIX conform ?
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 81 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
More information about the Python-list
mailing list