]> git.ipfire.org Git - people/ms/collecty.git/commitdiff
Add some command line flags and help. master
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Oct 2009 23:14:48 +0000 (01:14 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Oct 2009 23:14:48 +0000 (01:14 +0200)
Run collectyd --help for more information
about the usage.

collectyd

index 313a9db72a838977b0a34ea306ceb0470ecf1ffd..3fa6938388df253dcb4afae173ae57d1b44e37fa 100755 (executable)
--- a/collectyd
+++ b/collectyd
@@ -3,12 +3,21 @@
 import os
 import sys
 
+import optparse
+
 from collecty import Collecty
 
 c = Collecty()
 
-if len(sys.argv) > 1:
-       for file in sys.argv[1:]:
+# Parse command line options
+op = optparse.OptionParser(usage="usage: %prog [options] <configfile1> ... <configfileN>")
+op.add_option("-d", "--daemon", action="store_true", default=False,
+               help="Run as a daemon in background.")
+
+(options, configfiles) = op.parse_args()
+
+if configfiles:
+       for file in configfiles:
                c.read_config(file)
 else:
        c.read_config("/etc/collecty/collecty.conf")