Run 'chkconfig --add' for a service whose script is installed in
    /etc/init.d.  The service is initially configured to be disabled at all
    run-levels.
321801
def _chkconfig_add(name):
    '''
    
    '''
    cmd = '/sbin/chkconfig --add {0}'.format(name)
    if __salt__['cmd.retcode'](cmd, python_shell=False) == 0:
        log.info('Added initscript "%s" to chkconfig', name)
        return True
    else:
        log.error('Unable to add initscript "%s" to chkconfig', name)
        return False
1274980
def run_configure(args):
    """"""
    config_path = args.config or bigchaindb.config_utils.CONFIG_DEFAULT_PATH

    config_file_exists = False
    # if the config path is `-` then it's stdout
    if config_path != '-':
        config_file_exists = os.path.exists(config_path)

    if config_file_exists and not args.yes:
        want = input_on_stderr('Config file `{}` exists, do you want to '
                               'override it? (cannot be undone) [y/N]: '.format(config_path))
        if want != 'y':
            return

    conf = copy.deepcopy(bigchaindb.config)

    # select the correct config defaults based on the backend
    print('Generating default configuration for backend {}'
          .format(args.backend), file=sys.stderr)
    database_keys = bigchaindb._database_keys_map[args.backend]
    conf['database'] = bigchaindb._database_map[args.backend]

    if not args.yes:
        for key in ('bind', ):
            val = conf['server'][key]
            conf['server'][key] = input_on_stderr('API Server {}? (default `{}`): '.format(key, val), val)

        for key in ('scheme', 'host', 'port'):
            val = conf['wsserver'][key]
            conf['wsserver'][key] = input_on_stderr('WebSocket Server {}? (default `{}`): '.format(key, val), val)

        for key in database_keys:
            val = conf['database'][key]
            conf['database'][key] = input_on_stderr('Database {}? (default `{}`): '.format(key, val), val)

        for key in ('host', 'port'):
            val = conf['tendermint'][key]
            conf['tendermint'][key] = input_on_stderr('Tendermint {}? (default `{}`)'.format(key, val), val)

    if config_path != '-':
        bigchaindb.config_utils.write_config(conf, config_path)
    else:
        print(json.dumps(conf, indent=4, sort_keys=True))
    print('Configuration written to {}'.format(config_path), file=sys.stderr)
    print('Ready to go!', file=sys.stderr)
1053461
def disable_service(conn, service='ceph'):
    
    if is_systemd(conn):
        # Without the check, an error is raised trying to disable an
        # already disabled service
        if is_systemd_service_enabled(conn, service):
            remoto.process.run(
                conn,
                [
                    'systemctl',
                    'disable',
                    '{service}'.format(service=service),
                ]
            )
46053
def configure(conf, default_config=None):
    
    if conf.logconfig and os.path.isfile(conf.logconfig):
        logging.config.fileConfig(conf.logconfig,
                                  disable_existing_loggers=False)
    elif default_config and os.path.isfile(default_config):
        logging.config.fileConfig(default_config,
                                  disable_existing_loggers=False)
    else:
        init_console_logging(conf)
823470
def register_config_changes(self, configs, meta_changes):
        
        for config_file in meta_changes['remove_configs'].keys():
            self._purge_config_file(config_file)
        for config_file, config in configs.items():
            if 'update_attribs' in config:
                config['attribs'] = config.pop('update_attribs')
            if 'update_instance_name' in config:
                config['instance_name'] = config.pop('update_instance_name')
            if 'update_services' in config or 'remove_services' in config:
                remove = config.pop('remove_services', [])
                services = config.pop('update_services', [])
                # need to prevent old service defs from overwriting new ones
                for service in config['services']:
                    if service not in remove and service not in services:
                        services.append(service)
                config['services'] = services
            self._register_config_file(config_file, config)
1327399
def enable_service(conn, service='ceph'):
    
    if is_systemd(conn):
        remoto.process.run(
            conn,
            [
                'systemctl',
                'enable',
                '{service}'.format(service=service),
            ]
        )
    else:
        remoto.process.run(
            conn,
            [
                'chkconfig',
                '{service}'.format(service=service),
                'on',
            ]
        )
532218
private function configureDaemonDefinition(): void
    {
        $this->addOption('run-once', null, InputOption::VALUE_NONE, 'Run the command just once.');
        $this->addOption('run-max', null, InputOption::VALUE_OPTIONAL, 'Run the command x time.');
        $this->addOption('memory-max', null, InputOption::VALUE_OPTIONAL, 'Gracefully stop running command when given memory volume, in bytes, is reached.', 0);
        $this->addOption('shutdown-on-exception', null, InputOption::VALUE_NONE, 'Ask for shutdown if an exception is thrown.');
        $this->addOption('show-exceptions', null, InputOption::VALUE_NONE, 'Display exception on command output.');
    }
893639
def disable(name, **kwargs):
    '''
    
    '''
    if _service_is_upstart(name):
        return _upstart_disable(name)
    executable = _get_service_exec()
    cmd = [executable, '-f', name, 'remove']
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
349754
def service(
    state, host,
    *args, **kwargs
):
    '''
    
    '''

    if host.fact.which('systemctl'):
        yield systemd(state, host, *args, **kwargs)
        return

    if host.fact.which('initctl'):
        yield upstart(state, host, *args, **kwargs)
        return

    if host.fact.directory('/etc/init.d'):
        yield d(state, host, *args, **kwargs)
        return

    if host.fact.directory('/etc/rc.d'):
        yield rc(state, host, *args, **kwargs)
        return

    raise OperationError((
        'No init system found '
        '(no systemctl, initctl, /etc/init.d or /etc/rc.d found)'
    ))
142536
def enable(name, **kwargs):
    '''
    
    '''
    if 'runlevels' in kwargs:
        requested_levels = set(kwargs['runlevels'] if isinstance(kwargs['runlevels'],
                                                                 list) else [kwargs['runlevels']])
        enabled_levels, disabled_levels = _enable_delta(name, requested_levels)
        commands = []
        if disabled_levels:
            commands.append(_enable_disable_cmd(name, 'delete', disabled_levels))
        if enabled_levels:
            commands.append(_enable_disable_cmd(name, 'add', enabled_levels))
        if not commands:
            return True
    else:
        commands = [_enable_disable_cmd(name, 'add')]
    for cmd in commands:
        if _ret_code(cmd):
            return False
    return True
1052743
function run (config, done) {
  config = config || {}

  logger.setupFromConfig(config)

  done = helper.isFunction(done) ? done : process.exit
  config = cfg.parseConfig(config.configFile, config)

  let exitCode = 1
  const options = {
    hostname: config.hostname,
    path: config.urlRoot + 'run',
    port: config.port,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    }
  }

  const request = http.request(options, function (response) {
    response.on('data', function (buffer) {
      const parsedResult = parseExitCode(buffer, exitCode, config.failOnEmptyTestSuite)
      exitCode = parsedResult.exitCode
      process.stdout.write(parsedResult.buffer)
    })

    response.on('end', () => done(exitCode))
  })

  request.on('error', function (e) {
    if (e.code === 'ECONNREFUSED') {
      log.error('There is no server listening on port %d', options.port)
      done(1, e.code)
    } else {
      throw e
    }
  })

  request.end(JSON.stringify({
    args: config.clientArgs,
    removedFiles: config.removedFiles,
    changedFiles: config.changedFiles,
    addedFiles: config.addedFiles,
    refresh: config.refresh,
    colors: config.colors
  }))
}
206660
protected void setConfigurationService(ConfigurationService configService) {
        if (log.isLoggable(Level.FINER)) {
            log.finer("Set configuration service = " + configService);
        }

        configurationService = configService;

        if (configurationService != null) {
            initConfig();
        }
    }
736115
function setupSystemV (name, options, callback) {
  options.stdOut = (options.logDir && `${options.logDir}/${name}-out.log`) || '/dev/null'
  options.stdErr = (options.logDir && `${options.logDir}/${name}-err.log`) || '&1'

  const script = initdTemplate(options)

  if (options.dryRun) {
    console.log(script)
    return
  }

  const filepath = `/etc/init.d/${name}`
  console.log(`Installing service on: ${filepath}`)
  fs.exists(filepath, exists => {
    if(!exists) {
      fs.writeFile(filepath,script, err => {
        if (err) {
          callback(err)
          return
        }

        fs.chmod(filepath,'755', err => {
          if (err) {
            callback(err)
            return
          }

          callback(err, 'init.d service registered succesfully')
        })
      })
    } else {
      callback('Service already exists, please uninstall first')
    }
  })
}
432624
def _service_is_chkconfig(name):
    '''
    
    '''
    cmdline = '/sbin/chkconfig --list {0}'.format(name)
    return __salt__['cmd.retcode'](cmdline, python_shell=False, ignore_retcode=True) == 0
56665
def _add_dynamic_loading_option(config: ConfigParser) -> None:
        
        config.set(
            "defaults", "#– To connect to Infura use dynamic_loading: infura", ""
        )
        config.set(
            "defaults",
            "#– To connect to Rpc use "
            "dynamic_loading: HOST:PORT / ganache / infura-[network_name]",
            "",
        )
        config.set(
            "defaults", "#– To connect to local host use dynamic_loading: localhost", ""
        )
        config.set("defaults", "dynamic_loading", "infura")
1063854
private void initialize(Configuration conf) {
    this.nodeHealthScript = conf.get(HEALTH_CHECK_SCRIPT_PROPERTY);
    this.intervalTime = conf.getLong(HEALTH_CHECK_INTERVAL_PROPERTY,
        DEFAULT_HEALTH_CHECK_INTERVAL);
    this.scriptTimeout = conf.getLong(HEALTH_CHECK_FAILURE_INTERVAL_PROPERTY,
        DEFAULT_HEALTH_SCRIPT_FAILURE_INTERVAL);
    String[] args = conf.getStrings(HEALTH_CHECK_SCRIPT_ARGUMENTS_PROPERTY,
        new String[] {});
    timer = new NodeHealthMonitorExecutor(args);
  }
1197333
def init(config):
    
    from pkg_resources import resource_stream
    import shutil

    config_file = Path(config.config_file)
    if config_file.is_file():
        click.echo('{} already exists, maybe you want $ sedge update'.format(config_file))
        sys.exit()

    config_file.parent.mkdir(parents=True, exist_ok=True)
    with resource_stream(__name__, 'sedge_template.conf') as src_stream:
        with open(config.config_file, 'wb') as target_stream:
            shutil.copyfileobj(src_stream, target_stream)