From: Michael Tremer Date: Tue, 17 Nov 2009 08:48:50 +0000 (+0100) Subject: Add ability to run as a daemon. X-Git-Tag: 0.0.2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59bf99cacc92b218d6f912cb922810ee5e8cd3af;p=collecty.git Add ability to run as a daemon. --- diff --git a/collectyd b/collectyd index 95b0c42..a67dc36 100755 --- 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() +