Use ais.daemon when daemon is not available
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Wed, 18 Aug 2010 21:23:46 +0000 (21:23 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Wed, 18 Aug 2010 21:23:46 +0000 (21:23 +0000)
bin/inputs/run.py

index 277bf430eabe044fa3741ceba0b42f36884f20de..87dd091e0837a6b2b7228e637d794bd6d76a9aeb 100644 (file)
@@ -39,8 +39,12 @@ def main():
 
 
     if options.daemonize:
-        from daemon import DaemonContext
-        stderr = file('/var/log/ais/daemon.stderr', 'w+', 0o664)
+        try:
+            from daemon import DaemonContext
+        except ImportError:
+            from ais.daemon import DaemonContext
+
+        stderr = file('/var/log/ais/daemon.stderr', 'w+', 0664)
         dctx = DaemonContext(stdout=stderr, stderr=stderr, umask=002)
         dctx.open()