예제 #1
0
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 reactionner")
    parser.add_option('--debugfile',
                      dest='debug_file',
                      help=("Debug file. Default: not used "
                            "(why debug a bug free program? :) )"))
    parser.add_option(
        "-p",
        "--profile",
        dest="profile",
        help="Dump a profile file. Need the python cProfile librairy")

    opts, args = parser.parse_args()
    if args:
        parser.error("Does not accept any argument.")

    daemon = Reactionner(debug=opts.debug_file is not None, **opts.__dict__)
    daemon.main()
예제 #2
0
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 reactionner")
    parser.add_option('--debugfile', dest='debug_file',
                      help=("Debug file. Default: not used "
                            "(why debug a bug free program? :) )"))
    parser.add_option("-p", "--profile",
                      dest="profile",
                      help="Dump a profile file. Need the python cProfile librairy")

    opts, args = parser.parse_args()
    if args:
        parser.error("Does not accept any argument.")

    daemon = Reactionner(debug=opts.debug_file is not None, **opts.__dict__)
    daemon.main()
    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.reactionnerdaemon import Reactionner
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 reactionner")
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 = Reactionner(debug=opts.debug_file is not None, **opts.__dict__)
    daemon.main()