From: Michael Tremer Date: Sun, 11 Oct 2009 23:14:48 +0000 (+0200) Subject: Add some command line flags and help. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;p=people%2Fms%2Fcollecty.git Add some command line flags and help. Run collectyd --help for more information about the usage. --- diff --git a/collectyd b/collectyd index 313a9db..3fa6938 100755 --- 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] ... ") +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")