示例#1
0
def main(argv):

    # in any case redirect stdout and stderr
    std = FileLogger(smsgwglobals.wislogger)
    sys.stderr = std
    sys.stdout = std

    # Create the routingdb
    wisglobals.rdb = routingdb.Database()
    wisglobals.rdb.create_table_routing()
    wisglobals.rdb.read_routing()

    # Create message queue
    global SMS_QUEUE
    SMS_QUEUE = Queue()

    # Start the router
    rt = Router(2, "Router")
    rt.daemon = True
    rt.start()

    # Start the watchdog
    wd = Watchdog(1, "Watchdog", SMS_QUEUE)
    wd.daemon = True
    wd.start()

    # After startup let the watchdog run to clean database
    wisglobals.watchdogThreadNotify.set()

    wisserver = Wisserver()
    wisserver.run()
示例#2
0
文件: wis.py 项目: haouach/smsgateway
    def triggerwatchdog(self):
        smsgwglobals.wislogger.debug("TRIGGER WATCHDOG")

        smsgwglobals.wislogger.debug("TRIGGER WATCHDOG ROUTER")
        if wisglobals.routerThread is None:
            smsgwglobals.wislogger.debug("Router died! Restarting it!")
            rt = Router(2, "Router")
            rt.daemon = True
            rt.start()
        elif not wisglobals.routerThread.isAlive():
            smsgwglobals.wislogger.debug("Router died! Restarting it!")
            rt = Router(2, "Router")
            rt.daemon = True
            rt.start()
        else:
            pass

        if wisglobals.watchdogThread is None:
            smsgwglobals.wislogger.debug("Watchdog died! Restarting it!")
            wd = Watchdog(1, "Watchdog")
            wd.daemon = True
            wd.start()
        elif not wisglobals.watchdogThread.isAlive():
            smsgwglobals.wislogger.debug("Watchdog died! Restarting it!")
            wd = Watchdog(1, "Watchdog")
            wd.daemon = True
            wd.start()
        else:
            smsgwglobals.wislogger.debug("TRIGGER WATCHDOG")
            smsgwglobals.wislogger.debug("Wakup watchdog")
            wisglobals.watchdogThreadNotify.set()
示例#3
0
    def triggerwatchdog(self):
        smsgwglobals.wislogger.debug("TRIGGER WATCHDOG")

        smsgwglobals.wislogger.debug("TRIGGER WATCHDOG ROUTER")
        if wisglobals.routerThread is None:
            smsgwglobals.wislogger.debug("Router died! Restarting it!")
            rt = Router(2, "Router")
            rt.daemon = True
            rt.start()
        elif not wisglobals.routerThread.isAlive():
            smsgwglobals.wislogger.debug("Router died! Restarting it!")
            rt = Router(2, "Router")
            rt.daemon = True
            rt.start()
        else:
            pass

        if wisglobals.watchdogThread is None:
            smsgwglobals.wislogger.debug("Watchdog died! Restarting it!")
            wd = Watchdog(1, "Watchdog", SMS_QUEUE)
            wd.daemon = True
            wd.start()
        elif not wisglobals.watchdogThread.isAlive():
            smsgwglobals.wislogger.debug("Watchdog died! Restarting it!")
            wd = Watchdog(1, "Watchdog", SMS_QUEUE)
            wd.daemon = True
            wd.start()
        else:
            smsgwglobals.wislogger.debug("TRIGGER WATCHDOG")
            smsgwglobals.wislogger.debug("Wakup watchdog")
            wisglobals.watchdogThreadNotify.set()
示例#4
0
文件: wis.py 项目: haouach/smsgateway
def main(argv):

    # in any case redirect stdout and stderr
    std = FileLogger(smsgwglobals.wislogger)
    sys.stderr = std
    sys.stdout = std

    # Create the routingdb
    wisglobals.rdb = routingdb.Database()
    wisglobals.rdb.create_table_routing()
    wisglobals.rdb.read_routing()

    # Start the router
    rt = Router(2, "Router")
    rt.daemon = True
    rt.start()

    # Start the watchdog
    wd = Watchdog(1, "Watchdog")
    wd.daemon = True
    wd.start()

    # After startup let the watchdog run to clean database
    wisglobals.watchdogThreadNotify.set()

    wisserver = Wisserver()
    wisserver.run()