From 57c395f74f93d116c2db689002b2459205fa2ffd Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 12 Oct 2009 01:14:48 +0200 Subject: [PATCH] Add some command line flags and help. Run collectyd --help for more information about the usage. --- collectyd | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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") -- 2.39.2