Esempio n. 1
0
    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        pajbot.start()
    except KeyboardInterrupt:
        pajbot.quit_bot()


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


if __name__ == "__main__":
    from pajbot.utils import init_logging, dump_threads

    def on_sigusr1(signal, frame):
        log.info(
            "Process was interrupted with SIGUSR1, dumping all thread stack traces"
        )
        dump_threads()

    # dump all stack traces on SIGUSR1
    signal.signal(signal.SIGUSR1, on_sigusr1)
    sys.excepthook = handle_exceptions

    args = parse_args()

    init_logging("pajbot")
    run(args)
Esempio n. 2
0
    pajbot = Bot(config, args)

    pajbot.connect()

    def on_sigterm(signal, frame):
        pajbot.quit_bot()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        pajbot.start()
    except KeyboardInterrupt:
        pajbot.quit_bot()
        pass


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

if __name__ == '__main__':
    from pajbot.utils import init_logging

    sys.excepthook = handle_exceptions

    args = Bot.parse_args()

    init_logging('pajbot')
    run(args)
Esempio n. 3
0
    def on_sigterm(signal, frame):
        pajbot.quit_bot()
        sys.exit(0)

    signal.signal(signal.SIGTERM, on_sigterm)

    try:
        pajbot.start()
    except KeyboardInterrupt:
        pajbot.quit_bot()
        pass


def handle_exceptions(exctype, value, tb):
    log.error('Logging an uncaught exception', exc_info=(exctype, value, tb))
    with open('/srv/admiralbullbot/errors.txt', 'a') as f:
        newString = '{}\n{}\n{}\n'.format(exctype, value, tb)
        f.write(newString)


if __name__ == '__main__':
    from pajbot.utils import init_logging

    sys.excepthook = handle_exceptions

    args = Bot.parse_args()

    init_logging('pajbot')
    run(args)