Exemplo n.º 1
0
def main():
    if os.geteuid() != 0:
        print 'must run as root'
        sys.exit(1)
    if not check_commands(CMDS):
        sys.exit(1)

    webapp.run(app, host='0.0.0.0', port=settings.API_PORT)
Exemplo n.º 2
0
def main():
    if os.geteuid() != 0:
        print 'must run as root'
        sys.exit(1)
    if not check_commands(CMDS):
        sys.exit(1)

    webapp.run(app, host='0.0.0.0', port=settings.API_PORT)
Exemplo n.º 3
0
def main():
    if not check_commands(CMDS):
        sys.exit(1)

    factory = get_factory()
    factory.remove(daemon=True)

    # Logging handlers
    fh = RotatingFileHandler(settings.LOG_FILE, 'a',
            settings.LOG_SIZE, settings.LOG_COUNT)
    fh.setFormatter(logging.Formatter(settings.LOG_FORMAT))
    dh = DbHandler(logging.ERROR)
    factory.logging_handlers = (fh, dh)

    for module in get_package_modules(WORKERS_DIR):
        if module != '__init__':
            target = '%s.%s.%s.run' % (settings.PACKAGE_NAME, WORKERS_DIR, module)
            factory.add(target=target, daemon=True)

    factory.run()