Browse Source

reorder setsid and kill

auth
clowwindy 10 years ago
parent
commit
2b4c3619d6
  1. 6
      shadowsocks/daemon.py

6
shadowsocks/daemon.py

@ -123,12 +123,12 @@ def daemon_start(pid_file, log_file):
os.kill(ppid, signal.SIGINT) os.kill(ppid, signal.SIGINT)
sys.exit(1) sys.exit(1)
print('started')
os.kill(ppid, signal.SIGTERM)
os.setsid() os.setsid()
signal.signal(signal.SIG_IGN, signal.SIGHUP) signal.signal(signal.SIG_IGN, signal.SIGHUP)
print('started')
os.kill(ppid, signal.SIGTERM)
sys.stdin.close() sys.stdin.close()
try: try:
freopen(log_file, 'a', sys.stdout) freopen(log_file, 'a', sys.stdout)

Loading…
Cancel
Save