コード例 #1
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()
コード例 #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()