#!/usr/bin/python ############################################################################### # # # Cappie # # Copyright (C) 2010 Michael Tremer # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### import sys from cappie import Cappie def main(): from optparse import OptionParser op = OptionParser() op.add_option("-c", "--config", dest="config", help="read configuration from file", metavar="FILE", default="/etc/cappie/cappie.conf") op.add_option("-d", action="store_true", dest="debug", default=False) (options, args) = op.parse_args() cappie = Cappie() if options.config: cappie.readConfig(options.config) cappie.setDebug(options.debug) try: cappie.run() except KeyboardInterrupt: cappie.shutdown() except RuntimeError, e: print >>sys.stderr, e sys.exit(1) #sys.exit(0) main()