]> git.ipfire.org Git - collecty.git/commitdiff
Add ability to run as a daemon.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Nov 2009 08:48:50 +0000 (09:48 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Nov 2009 08:48:50 +0000 (09:48 +0100)
collectyd

index 95b0c425df9a27758b9a6d6d46c15019e7eedcb4..a67dc36cf08d12e8ff3446dec9ef5b42e1e9054d 100755 (executable)
--- a/collectyd
+++ b/collectyd
@@ -3,6 +3,7 @@
 import os
 import sys
 
+import daemon
 import optparse
 
 import collecty
@@ -26,4 +27,9 @@ if not c.instances:
        print >>sys.stderr, "Error: No instances were configured."
        sys.exit(1)
 
-c.run()
+if options.daemon:
+       with daemon.DaemonContext(stdout=sys.stdout, stderr=sys.stderr):
+               c.run()
+else:
+       c.run()
+