Lines 12-18
def daemonize():
Link Here
|
12 |
# attempt most os activity early, to catch errors before we fork |
12 |
# attempt most os activity early, to catch errors before we fork |
13 |
os.umask(0o022) # -rw-r--r-- / 0644 / u=rw,go=r |
13 |
os.umask(0o022) # -rw-r--r-- / 0644 / u=rw,go=r |
14 |
pidout = OPTS.pidfile and open(OPTS.pidfile, 'w') |
14 |
pidout = OPTS.pidfile and open(OPTS.pidfile, 'w') |
15 |
os.setsid() |
15 |
try: |
|
|
16 |
os.setsid() |
17 |
except OSError as e: |
18 |
# ignore EPERM: already a process group leader |
19 |
pass |
16 |
#first fork: create intermediate child process |
20 |
#first fork: create intermediate child process |
17 |
pid = os.fork() |
21 |
pid = os.fork() |
18 |
except IOError as e: |
22 |
except IOError as e: |