Daemonizing python

Paul Rubin http
Sun Sep 24 17:35:31 EDT 2006


NinjaZombie <ninjazombie at net.hr> writes:
> Thanks guys, but I'm a little new to this. Take a look at this very simple
> code:
> 
> import os
> print "Entering program"
> os.fork()
> while (1):
> 	pass    # some other work

Try it this way:

     import os, sys
     print "Entering program"

     if os.fork():
        sys.exit()              # parent process exits so shell returns

     while (1):                 # child process continues
            pass    # some other work



More information about the Python-list mailing list