Author: Matthew Ogilvie Date: Sun Jul 26 14:38:09 2020 -0600 ignore exception from os.setsid() Typically something external (such as start-stop-daemon) will have already done a setsid(). diff --git a/replicator/Utils.py b/replicator/Utils.py index d2c4f94..5b08bcf 100644 --- a/replicator/Utils.py +++ b/replicator/Utils.py @@ -12,7 +12,11 @@ def daemonize(): # attempt most os activity early, to catch errors before we fork os.umask(0o022) # -rw-r--r-- / 0644 / u=rw,go=r pidout = OPTS.pidfile and open(OPTS.pidfile, 'w') - os.setsid() + try: + os.setsid() + except OSError as e: + # ignore EPERM: already a process group leader + pass #first fork: create intermediate child process pid = os.fork() except IOError as e: