Exemplo n.º 1
0
def run(args):
    from tbutil import load_config
    config = load_config(args.config)

    if 'main' not in config:
        log.error('Missing section [main] in config')
        sys.exit(0)

    if 'sql' not in config:
        log.error('Missing section [sql] in config')
        sys.exit(0)

    tyggbot = TyggBot(config, args)

    tyggbot.connect()

    def on_sigterm(signal, frame):
        tyggbot.quit()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        tyggbot.start()
    except KeyboardInterrupt:
        tyggbot.quit()
        pass
Exemplo n.º 2
0
def run(args):
    from tbutil import load_config
    config = load_config(args.config)

    if 'main' not in config:
        log.error('Missing section [main] in config')
        sys.exit(0)

    if 'sql' not in config:
        log.error('Missing section [sql] in config')
        sys.exit(0)

    tyggbot = TyggBot(config, args)

    tyggbot.connect()

    def on_sigterm(signal, frame):
        tyggbot.quit()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        tyggbot.start()
    except KeyboardInterrupt:
        tyggbot.quit()
        pass
Exemplo n.º 3
0
def run(args):
    tyggbot = TyggBot(load_config(args.config), args)

    tyggbot.connect()

    def on_sigterm(signal, frame):
        tyggbot.quit()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        tyggbot.start()
    except KeyboardInterrupt:
        tyggbot.quit()
        pass
Exemplo n.º 4
0
def run(args):
    tyggbot = TyggBot(load_config(args.config), args)

    tyggbot.connect()

    def on_sigterm(signal, frame):
        tyggbot.quit()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        tyggbot.start()
    except KeyboardInterrupt:
        tyggbot.quit()
        pass

def handle_exceptions(exctype, value, tb):
    log.error('Logging an uncaught exception', exc_info=(exctype, value, tb))

if __name__ == "__main__":
    from tbutil import init_logging

    sys.excepthook = handle_exceptions

    args = TyggBot.parse_args()

    init_logging('tyggbot')
    run(args)
Exemplo n.º 5
0
    tyggbot = TyggBot(config, args)

    tyggbot.connect()

    def on_sigterm(signal, frame):
        tyggbot.quit()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        tyggbot.start()
    except KeyboardInterrupt:
        tyggbot.quit()
        pass


def handle_exceptions(exctype, value, tb):
    log.error('Logging an uncaught exception', exc_info=(exctype, value, tb))


if __name__ == "__main__":
    from tbutil import init_logging

    sys.excepthook = handle_exceptions

    args = TyggBot.parse_args()

    init_logging('tyggbot')
    run(args)