Exemplo n.º 1
0
            processor.Do()
        
        print "Exiting program... Bye!"

if __name__ == '__main__':
    
    parser = argparse.ArgumentParser(description = "Offwind processing application v.1.0. Please, send all questions and suggestions to [email protected]")
    parser.add_argument("action",
                        help = "action to perform",
                        choices = ["init", "cleanup", "run", "start", "stop", "restart"],
                        nargs = '?',
                        default = "run")
    args = parser.parse_args()

    if (args.action == "init"):
        Configurator().init()
    elif (args.action == "cleanup"):
        config = Configurator().read()
        processor = Processor()
        processor.config = config        
        processor.cleanup()
        print "Cleanup finished"
    elif (args.action == "start"):
        MyDaemon('/tmp/offwind-proc.pid').start()
    elif (args.action == "stop"):
        MyDaemon('/tmp/offwind-proc.pid').stop()
    elif (args.action == "run"):
        MyDaemon('/tmp/offwind-proc.pid').run()
    elif (args.action == "restart"):
        MyDaemon('/tmp/offwind-proc.pid').restart()
Exemplo n.º 2
0
if __name__ == '__main__':

    parser = argparse.ArgumentParser(
        description=
        "Offwind processing application v.1.0. Please, send all questions and suggestions to [email protected]"
    )
    parser.add_argument(
        "action",
        help="action to perform",
        choices=["init", "cleanup", "run", "start", "stop", "restart"],
        nargs='?',
        default="run")
    args = parser.parse_args()

    if (args.action == "init"):
        Configurator().init()
    elif (args.action == "cleanup"):
        config = Configurator().read()
        processor = Processor()
        processor.config = config
        processor.cleanup()
        print "Cleanup finished"
    elif (args.action == "start"):
        MyDaemon('/tmp/offwind-proc.pid').start()
    elif (args.action == "stop"):
        MyDaemon('/tmp/offwind-proc.pid').stop()
    elif (args.action == "run"):
        MyDaemon('/tmp/offwind-proc.pid').run()
    elif (args.action == "restart"):
        MyDaemon('/tmp/offwind-proc.pid').restart()