Launching a subprocess without waiting around for the result?
Gary Herron
gherron at islandtraining.com
Fri Sep 19 17:02:56 EDT 2008
Almar Klein wrote:
>
> Ah, no, that's a different thing. If the parent exits, the child will
> also be killed I believe.
>
>
> Not if it's stuck in some endless loop...
>
> If you want to spawn a process and have it live on independent of the
> parent, you want to make the child process a "daemon", detatching
> itself from the parent's environment. I don't recall how that's done
> immediately, but those are the terms to search for.
>
>
> I'm curious how this can be done, does anyone know this?
I just dove into this several day ago for a small project.
On Linux it's easy -- it involves a couple of forks and other system
calls. Google for daemonize.py.
<http://github.com/lfittl/python-helpers/tree/master/daemonize.py>
On Windows, a bit of searching seems to find a consensus that the way to
do something similar is as a Window's service. I'm just now looking
into how to register and start a service, and how to stop and remove it
later. Google finds lots of information on this -- perhaps I'll post my
result when I've pulled it all together.
Gary Herron
More information about the Python-list
mailing list