def main(): parser = optparse.OptionParser("%prog [options]", version="%prog " + VERSION) parser.add_option('-c', '--config', dest="config_file", metavar="INI-CONFIG-FILE", help='Config file') parser.add_option('-d', '--daemon', action='store_true', dest="is_daemon", help="Run in daemon mode") parser.add_option('-r', '--replace', action='store_true', dest="do_replace", help="Replace previous running receiver") parser.add_option('--debugfile', dest='debug_file', help=("Debug file. Default: not used " "(why debug a bug free program? :) )")) opts, args = parser.parse_args() if args: parser.error("Does not accept any argument.") daemon = Receiver(debug=opts.debug_file is not None, **opts.__dict__) daemon.main()
def main(): parser = optparse.OptionParser( "%prog [options]", version="%prog " + VERSION) parser.add_option('-c', '--config', dest="config_file", metavar="INI-CONFIG-FILE", help='Config file') parser.add_option('-d', '--daemon', action='store_true', dest="is_daemon", help="Run in daemon mode") parser.add_option('-r', '--replace', action='store_true', dest="do_replace", help="Replace previous running receiver") parser.add_option('--debugfile', dest='debug_file', help=("Debug file. Default: not used " "(why debug a bug free program? :) )")) opts, args = parser.parse_args() if args: parser.error("Does not accept any argument.") daemon = Receiver(debug=opts.debug_file is not None, **opts.__dict__) daemon.main()
# Submodules will then be loaded from there, too. import imp imp.load_module('shinken', *imp.find_module('shinken', [os.path.realpath("."), os.path.realpath(".."), os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "..")])) from shinken.daemons.receiverdaemon import Receiver from shinken.bin import VERSION parser = optparse.OptionParser( "%prog [options]", version="%prog " + VERSION) parser.add_option('-c', '--config', dest="config_file", metavar="CONFIG-FILE", help='Config file') parser.add_option('-d', '--daemon', action='store_true', dest="is_daemon", help="Run in daemon mode") parser.add_option('-r', '--replace', action='store_true', dest="do_replace", help="Replace previous running receiver") parser.add_option('--debugfile', dest='debug_file', help=("Debug file. Default: not used " "(why debug a bug free program? :) )")) opts, args = parser.parse_args() if args: parser.error("Does not accept any argument.") # Protect for windows multiprocessing that will RELAUNCH all if __name__ == '__main__': daemon = Receiver(debug=opts.debug_file is not None, **opts.__dict__) daemon.main()