Now using the PEP3142 daemon lib
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Wed, 18 Aug 2010 21:17:21 +0000 (21:17 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Wed, 18 Aug 2010 21:17:21 +0000 (21:17 +0000)
bin/inputs/run.py

index b3c32b07baeb387d7800d86fef51c89520d3b042..277bf430eabe044fa3741ceba0b42f36884f20de 100644 (file)
@@ -39,28 +39,10 @@ def main():
 
 
     if options.daemonize:
-        from ais import daemonize
-        
-        daemonize.UMASK = 002
-        daemonize.REDIRECT_TO = '/var/log/ais/stderr'
-
-        daemonize.createDaemon()
-
-        #retCode = daemonize.createDaemon()
-        #procParams = """
-        #return code = %s
-        #process ID = %s
-        #parent process ID = %s
-        #process group ID = %s
-        #session ID = %s
-        #user ID = %s
-        #effective user ID = %s
-        #real group ID = %s
-        #effective group ID = %s
-        #""" % (retCode, os.getpid(), os.getppid(), os.getpgrp(), os.getsid(0),
-        #os.getuid(), os.geteuid(), os.getgid(), os.getegid())
-
-        #open("/var/log/ais/createDaemon.log", "w").write(procParams + "\n")
+        from daemon import DaemonContext
+        stderr = file('/var/log/ais/daemon.stderr', 'w+', 0o664)
+        dctx = DaemonContext(stdout=stderr, stderr=stderr, umask=002)
+        dctx.open()
 
     if options.debug:
         loglevel = logging.DEBUG