From dae2624b307e083bd9fbd70b7bf3a71e47ca3317 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 21 Dec 2014 14:49:51 +0800 Subject: [PATCH] add setsid --- shadowsocks/daemon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shadowsocks/daemon.py b/shadowsocks/daemon.py index d694e94..9e252e0 100644 --- a/shadowsocks/daemon.py +++ b/shadowsocks/daemon.py @@ -126,6 +126,9 @@ def daemon_start(pid_file, log_file): print('started') os.kill(ppid, signal.SIGTERM) + os.setsid() + signal.signal(signal.SIG_IGN, signal.SIGHUP) + sys.stdin.close() try: freopen(log_file, 'a', sys.stdout)