An Upstart service is assumed disabled if a manual stanza is
    placed in /etc/init/[name].override.
    NOTE: An Upstart service can also be disabled by placing "manual"
    in /etc/init/[name].conf.
488633
def _upstart_is_disabled(name):
    '''
    
    '''
    files = ['/etc/init/{0}.conf'.format(name), '/etc/init/{0}.override'.format(name)]
    for file_name in filter(os.path.isfile, files):
        with salt.utils.files.fopen(file_name) as fp_:
            if re.search(r'^\s*manual',
                         salt.utils.stringutils.to_unicode(fp_.read()),
                         re.MULTILINE):
                return True
    return False
596472
def set_service(self, name, service_config, project=False):
        
        if not self.project_config.services or name not in self.project_config.services:
            self._raise_service_not_valid(name)
        self._validate_service(name, service_config)
        self._set_service(name, service_config, project)
        self._load_services()
1280886
def disable(self):
        """"""
        self.post("disable")
        if self.service.restart_required:
            self.service.restart(120)
        return self
510375
def removeService(self, service):
        
        for name, wrapper in self.services.iteritems():
            if service in (name, wrapper.service):
                del self.services[name]
                return

        raise NameError("Service %r not found" % (service,))
972725
function isAutostartEnabled(key, callback) {
  if (arguments.length < 1) {
    throw new Error('Not enough arguments passed to isAutostartEnabled()');
  } else if (typeof key !== 'string') {
    throw new TypeError('Passed "key" to disableAutostart() is not a string.');
  }

  if (typeof callback !== 'function') {
    return new Promise((resolve, reject) => {
      autostart.isAutostartEnabled(key, (error, isEnabled) => {
        if (error) {
          reject(error);
        } else {
          resolve(isEnabled);
        }
      });
    });
  }

  autostart.isAutostartEnabled(key, (error, isEnabled) => {
    callback(error, isEnabled);
  });
}
520928
def restart(name):
    '''
    
    '''
    if _service_is_upstart(name):
        cmd = 'restart {0}'.format(name)
    else:
        cmd = '/sbin/service {0} restart'.format(name)
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
1298978
def restart(self, name):
        
        init = self._get_implementation(name)
        self._assert_service_installed(init, name)
        logger.info('Restarting service: %s...', name)
        init.stop()
        # Here we would use status to verify that the service stopped
        # before restarting. If only status was stable. eh..
        # The arbitrarity of this sleep time is making me sick...
        time.sleep(3)
        init.start()
874933
@Override
  protected void serviceInit(Configuration conf) throws Exception {
    _conf = conf;

    boolean stopOnFailure = conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE);

    try {
      // In case this NM was killed while there were running spark applications, we need to restore
      // lost state for the existing executors. We look for an existing file in the NM's local dirs.
      // If we don't find one, then we choose a file to use to save the state next time.  Even if
      // an application was stopped while the NM was down, we expect yarn to call stopApplication()
      // when it comes back
      if (_recoveryPath != null) {
        registeredExecutorFile = initRecoveryDb(RECOVERY_FILE_NAME);
      }

      TransportConf transportConf = new TransportConf("shuffle", new HadoopConfigProvider(conf));
      blockHandler = new ExternalShuffleBlockHandler(transportConf, registeredExecutorFile);

      // If authentication is enabled, set up the shuffle server to use a
      // special RPC handler that filters out unauthenticated fetch requests
      List<TransportServerBootstrap> bootstraps = Lists.newArrayList();
      boolean authEnabled = conf.getBoolean(SPARK_AUTHENTICATE_KEY, DEFAULT_SPARK_AUTHENTICATE);
      if (authEnabled) {
        secretManager = new ShuffleSecretManager();
        if (_recoveryPath != null) {
          loadSecretsFromDb();
        }
        bootstraps.add(new AuthServerBootstrap(transportConf, secretManager));
      }

      int port = conf.getInt(
        SPARK_SHUFFLE_SERVICE_PORT_KEY, DEFAULT_SPARK_SHUFFLE_SERVICE_PORT);
      transportContext = new TransportContext(transportConf, blockHandler);
      shuffleServer = transportContext.createServer(port, bootstraps);
      // the port should normally be fixed, but for tests its useful to find an open port
      port = shuffleServer.getPort();
      boundPort = port;
      String authEnabledString = authEnabled ? "enabled" : "not enabled";

      // register metrics on the block handler into the Node Manager's metrics system.
      blockHandler.getAllMetrics().getMetrics().put("numRegisteredConnections",
          shuffleServer.getRegisteredConnections());
      YarnShuffleServiceMetrics serviceMetrics =
          new YarnShuffleServiceMetrics(blockHandler.getAllMetrics());

      MetricsSystemImpl metricsSystem = (MetricsSystemImpl) DefaultMetricsSystem.instance();
      metricsSystem.register(
          "sparkShuffleService", "Metrics on the Spark Shuffle Service", serviceMetrics);
      logger.info("Registered metrics with Hadoop's DefaultMetricsSystem");

      logger.info("Started YARN shuffle service for Spark on port {}. " +
        "Authentication is {}.  Registered executor file is {}", port, authEnabledString,
        registeredExecutorFile);
    } catch (Exception e) {
      if (stopOnFailure) {
        throw e;
      } else {
        noteFailure(e);
      }
    }
  }
975386
def unsuspendTabProviders(installation):
    
    if not installation.suspended:
        raise RuntimeError("Installation not suspended")
    powerups = list(installation.allPowerups)
    allSNEs = list(powerups[0].store.powerupsFor(ISuspender))
    for p in powerups:
        for sne in allSNEs:
            if sne.originalNE is p:
                p.store.powerDown(sne, INavigableElement)
                p.store.powerDown(sne, ISuspender)
                p.store.powerUp(p, INavigableElement)
                sne.deleteFromStore()
    installation.suspended = False
276706
def get_enabled():
    '''
    
    '''
    raw_services = _get_services()
    services = set()
    for service in raw_services:
        if info(service['ServiceName'])['StartType'] in ['Auto']:
            services.add(service['ServiceName'])

    return sorted(services)
364291
def service_start(name):
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'service/start/'+name, decode_type='json', decode=True)
    return r['dict']
1280530
private void unregisterQuickStartSecurityRegistryConfiguration() {
        if (urConfigReg != null) {
            urConfigReg.unregister();
            urConfigReg = null;
            quickStartRegistry = null;
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "QuickStartSecurityRegistry configuration is not registered.");
            }
        }
    }
480477
private void initEmbedded(String[] args, String[] services) {
        if (m_bInitialized) {
            m_logger.warn("initEmbedded: Already initialized -- ignoring");
            return;
        }
        m_logger.info("Initializing embedded mode");
        initConfig(args);
        initEmbeddedServices(services);
        RESTService.instance().registerCommands(CMD_CLASSES);
        m_bInitialized = true;
    }
1338086
def service_disable(s_name, s_delay=None, **connection_args):
    '''
    
    '''
    ret = True
    service = _service_get(s_name, **connection_args)
    if service is None:
        return False
    if s_delay is not None:
        service.set_delay(s_delay)
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    try:
        NSService.disable(nitro, service)
    except NSNitroError as error:
        log.debug('netscaler module error - NSService.enable() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
240936
function () {
				BaseController.prototype.onInit.call(this);

				// manually call the handler once at startup as device API won't do this for us
				this._onOrientationChange({
					landscape: Device.orientation.landscape
				});

				this.handleDocumentationDisclaimer();
			}
65730
def _service_is_sysv(name):
    '''
    
    '''
    script = '/etc/init.d/{0}'.format(name)
    return not _service_is_upstart(name) and os.access(script, os.X_OK)
737572
def enabled_service_owners():
    '''
    
    '''
    error = {}
    if 'pkg.owner' not in __salt__:
        error['Unsupported Package Manager'] = (
            'The module for the package manager on this system does not '
            'support looking up which package(s) owns which file(s)'
        )

    if 'service.show' not in __salt__:
        error['Unsupported Service Manager'] = (
            'The module for the service manager on this system does not '
            'support showing descriptive service data'
        )

    if error:
        return {'Error': error}

    ret = {}
    services = __salt__['service.get_enabled']()

    for service in services:
        data = __salt__['service.show'](service)
        if 'ExecStart' not in data:
            continue
        start_cmd = data['ExecStart']['path']
        pkg = __salt__['pkg.owner'](start_cmd)
        ret[service] = next(six.itervalues(pkg))

    return ret