]> git.ipfire.org Git - people/ms/collecty.git/blame - collectyd
Add some command line flags and help.
[people/ms/collecty.git] / collectyd
CommitLineData
a49a4b46
MT
1#!/usr/bin/python
2
3import os
4import sys
5
57c395f7
MT
6import optparse
7
a49a4b46
MT
8from collecty import Collecty
9
10c = Collecty()
11
57c395f7
MT
12# Parse command line options
13op = optparse.OptionParser(usage="usage: %prog [options] <configfile1> ... <configfileN>")
14op.add_option("-d", "--daemon", action="store_true", default=False,
15 help="Run as a daemon in background.")
16
17(options, configfiles) = op.parse_args()
18
19if configfiles:
20 for file in configfiles:
a49a4b46
MT
21 c.read_config(file)
22else:
23 c.read_config("/etc/collecty/collecty.conf")
24
25if not c.instances:
26 print >>sys.stderr, "Error: No instances were configured."
27 sys.exit(1)
28
29c.run()