Created
July 6, 2015 02:01
-
-
Save cannium/7aa58f13c834920bb32c to your computer and use it in GitHub Desktop.
example for double fork
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
print 'pid,pgid,sid', os.getpid(), os.getpgid(0), os.getsid(0) | |
pid = os.fork() | |
if pid > 0: | |
sys.exit(0) | |
print 'pid,pgid,sid', os.getpid(), os.getpgid(0), os.getsid(0) | |
os.setsid() | |
print 'pid,pgid,sid', os.getpid(), os.getpgid(0), os.getsid(0) | |
pid = os.fork() | |
if pid > 0: | |
sys.exit(0) | |
print 'pid,pgid,sid', os.getpid(), os.getpgid(0), os.getsid(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment