Esempio n. 1
0
    def run(self):
        log.info("-------------------------------------------")
        log.info("%s successfully initialised   " % CONS_PRODUCT_NAME)
        log.info("-------------------------------------------")

        th_invoked = Thread(target=call_invoked, args=())
        th_collector = Thread(target=call_continuous, args=())
        #th_collector.daemon = True
        #th_collector.daemon = True
        print "Starting Invoked Thread"
        th_invoked.start()
        print "Starting Continuous Thread"
        th_collector.start()
Esempio n. 2
0
        #th_invoked.join()    


DEV = True

if not DEV:
    try:
        if sys.argv[1] == None or sys.argv[1] == "start" or sys.argv[1] == "stop" or sys.argv[1] == "restart" or sys.argv[1] == "reload":
            pass
        else:
            print "Parameter '%s' is  not valid: Valid only [start|stop|restart|reload]" % sys.argv[1]
            sys.exit(1)
    except:
        print "%s: [start|stop|restart|reload]" % CONS_PRODUCT_NAME
        sys.exit(1)

    if sys.argv[1] == "stop":
        log.info("-----------------------------------")
        log.info("%s successfully shutdown      " % CONS_PRODUCT_NAME)
        log.info("-----------------------------------")

app = App()

if not DEV:
    daemon_runner = my_DaemonRunner(app)
    daemon_runner.daemon_context.files_preserve = [handler.stream]
    daemon_runner.do_action()
else:
    app.run()