Пример #1
0
def run():
    args = parse_args()

    if not os.path.exists(BASE_PATH):
        os.mkdir(BASE_PATH)
        os.mkdir(LOG_PATH)
        os.mkdir(os.path.join(BASE_PATH, 'data'))
        shutil.copy(EXAMPLE_CONF, CONF_PATH)


    daemon_args = {
        'verbose': args.verbose,
        'foreground': args.foreground,
        'log_dir': args.log_dir,
        'test_dir': args.test_dir
    }

    if args.foreground:
        daemon_args['console_log'] = True

    if args.config:
        daemon_args['config_file'] = args.config

    if args.run_dir:
        daemon_args['run_dir'] = args.run_dir

    if args.pid_file:
        daemon_args['pid_file'] = args.pid_file

    daemonize(**daemon_args)
Пример #2
0
def run():
    args = parse_args()

    if not os.path.exists(BASE_PATH):
        os.mkdir(BASE_PATH)
        os.mkdir(LOG_PATH)
        os.mkdir(os.path.join(BASE_PATH, 'data'))
        shutil.copy(EXAMPLE_CONF, CONF_PATH)


    daemon_args = {
        'verbose': args.verbose,
        'foreground': args.foreground,
        'log_dir': args.log_dir
    }

    if args.foreground:
        daemon_args['console_log'] = True

    if args.config:
        daemon_args['config_file'] = args.config

    if args.run_dir:
        daemon_args['run_dir'] = args.run_dir

    if args.pid_file:
        daemon_args['pid_file'] = args.pid_file

    daemonize(**daemon_args)
Пример #3
0
def run():
    args = parse_args()

    # TODO Fix up run_dir (especially in macros branch as things will break)
    if not os.path.exists(RAZER_CONFIG_HOME):
        os.makedirs(RAZER_CONFIG_HOME, exist_ok=True)
    if not os.path.exists(RAZER_DATA_HOME):
        os.makedirs(RAZER_DATA_HOME, exist_ok=True)
    if not os.path.exists(LOG_PATH):
        os.makedirs(LOG_PATH, exist_ok=True)
    if not os.path.exists(CONF_FILE):
        if os.path.exists(EXAMPLE_CONF_FILE):
            shutil.copy(EXAMPLE_CONF_FILE, CONF_FILE)
        else:
            print('Cant find "{0}"'.format(EXAMPLE_CONF_FILE), file=sys.stderr)

    if args.stop:
        stop_daemon()
        sys.exit(0)

    if args.respawn:
        stop_daemon()

    daemon_args = {
        'verbose': args.verbose,
        'foreground': args.foreground,
        'log_dir': args.log_dir,
        'test_dir': args.test_dir
    }

    if args.foreground:
        daemon_args['console_log'] = True

    if args.config:
        daemon_args['config_file'] = args.config

    if args.run_dir:
        daemon_args['run_dir'] = args.run_dir

    daemonize(**daemon_args)
Пример #4
0
def run():
    args = parse_args()

    if not os.path.exists(BASE_PATH):
        os.mkdir(BASE_PATH)
        os.mkdir(LOG_PATH)
        os.mkdir(os.path.join(BASE_PATH, 'data'))
        if os.path.exists(EXAMPLE_CONF):
            shutil.copy(EXAMPLE_CONF, CONF_PATH)
        else:
            print('Cant find "{0}"'.format(EXAMPLE_CONF), file=sys.stderr)

    if args.stop:
        stop_daemon()
        sys.exit(0)

    if args.respawn:
        stop_daemon()

    daemon_args = {
        'verbose': args.verbose,
        'foreground': args.foreground,
        'log_dir': args.log_dir,
        'test_dir': args.test_dir
    }

    if args.foreground:
        daemon_args['console_log'] = True

    if args.config:
        daemon_args['config_file'] = args.config

    if args.run_dir:
        daemon_args['run_dir'] = args.run_dir

    if args.pid_file:
        daemon_args['pid_file'] = args.pid_file

    daemonize(**daemon_args)