Disable the named service to start at boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.disable <service name>
484113
def disable(name, **kwargs):
    '''
    
    '''
    osmajor = _osrel()[0]
    if osmajor < '6':
        cmd = 'update-rc.d -f {0} remove'.format(name)
    else:
        cmd = 'update-rc.d {0} disable'.format(name)
    return not __salt__['cmd.retcode'](cmd)
268907
def disable(self, name=None):
        """"""
        if name is None:
            for name in self._actions_dict:
                self.disable(name)
            return
        self._actions_dict[name].qaction.setEnabled(False)
897369
def StopPreviousService(self):
    """"""
    StopService(
        service_name=config.CONFIG["Nanny.service_name"],
        service_binary_name=config.CONFIG["Nanny.service_binary_name"])

    if not config.CONFIG["Client.fleetspeak_enabled"]:
      return

    StopService(service_name=config.CONFIG["Client.fleetspeak_service_name"])

    # Delete GRR's Fleetspeak config from the registry so Fleetspeak
    # doesn't try to restart GRR unless/until installation completes
    # successfully.
    key_path = config.CONFIG["Client.fleetspeak_unsigned_services_regkey"]
    regkey = OpenRegkey(key_path)
    try:
      winreg.DeleteValue(regkey, config.CONFIG["Client.name"])
      logging.info("Deleted value '%s' of key '%s'.",
                   config.CONFIG["Client.name"], key_path)
    except OSError as e:
      # Windows will raise a no-such-file-or-directory error if
      # GRR's config hasn't been written to the registry yet.
      if e.errno != errno.ENOENT:
        raise
1094050
def do_stop_service(self, service):
        
        if not self.has_cluster():
            return None

        if self.service_action(service=service, action="stop"):
            print("%s is being stopped" % (service))
        else:
            print("Error stopping service")
            return None
1176239
def _upstart_enable(name):
    '''
    
    '''
    if _upstart_is_enabled(name):
        return _upstart_is_enabled(name)
    override = '/etc/init/{0}.override'.format(name)
    files = ['/etc/init/{0}.conf'.format(name), override]
    for file_name in filter(os.path.isfile, files):
        with salt.utils.files.fopen(file_name, 'r+') as fp_:
            new_text = re.sub(r'^\s*manual\n?',
                              '',
                              salt.utils.stringutils.to_unicode(fp_.read()),
                              0,
                              re.MULTILINE)
            fp_.seek(0)
            fp_.write(
                salt.utils.stringutils.to_str(
                    new_text
                )
            )
            fp_.truncate()
    if os.access(override, os.R_OK) and os.path.getsize(override) == 0:
        os.unlink(override)
    return _upstart_is_enabled(name)
1016667
def disable_selinux():
    

    if contains(filename='/etc/selinux/config',
                text='SELINUX=enforcing'):
        sed('/etc/selinux/config',
            'SELINUX=enforcing', 'SELINUX=disabled', use_sudo=True)

    if contains(filename='/etc/selinux/config',
                text='SELINUX=permissive'):
        sed('/etc/selinux/config',
            'SELINUX=permissive', 'SELINUX=disabled', use_sudo=True)

    if sudo('getenforce').lower() != 'disabled':
        with settings(warn_only=True, capture=True):
            sudo('/sbin/reboot')
        sleep_for_one_minute()
231250
def _start_services(self, console_env):
        """"""
        self._ad.services.register('sl4a', sl4a_service.Sl4aService)
        console_env['s'] = self._ad.services.sl4a
        console_env['sl4a'] = self._ad.sl4a
        console_env['ed'] = self._ad.ed
90587
def delete_service(self, name):
    
    return services.delete_service(self._get_resource_root(), name, self.name)
1280886
def disable(self):
        """"""
        self.post("disable")
        if self.service.restart_required:
            self.service.restart(120)
        return self
958925
def enable(name, **kwargs):
    '''
    
    '''
    cmd = '/usr/sbin/svcadm enable {0}'.format(name)
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
902805
def stop(self):
        
        try:
            sh.systemctl.stop(self.name)
        except sh.ErrorReturnCode_5:
            self.logger.debug('Service not running.')
370314
def disable(iface):
    '''
    
    '''
    if is_disabled(iface):
        return True
    cmd = ['netsh', 'interface', 'set', 'interface',
           'name={0}'.format(iface),
           'admin=DISABLED']
    __salt__['cmd.run'](cmd, python_shell=False)
    return is_disabled(iface)
316178
def _sysv_enable(name):
    '''
    
    '''
    if not _service_is_chkconfig(name) and not _chkconfig_add(name):
        return False
    cmd = '/sbin/chkconfig {0} on'.format(name)
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
987854
function disable() {
		const namespaces = [
			...createDebug.names.map(toNamespace),
			...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
		].join(',');
		createDebug.enable('');
		return namespaces;
	}
1347174
def delete_service_bindings(self, service_name):
        
        instance = self.get_instance(service_name)
        return self.api.delete(instance['service_bindings_url'])
911317
def StopService(service_name, service_binary_name=None):
  
  # QueryServiceStatus returns: scvType, svcState, svcControls, err,
  # svcErr, svcCP, svcWH
  try:
    status = win32serviceutil.QueryServiceStatus(service_name)[1]
  except pywintypes.error as e:
    if getattr(e, "winerror", None) == winerror.ERROR_SERVICE_DOES_NOT_EXIST:
      logging.debug("Tried to stop '%s', but the service is not installed.",
                    service_name)
    else:
      logging.exception("Unable to query status of service '%s':", service_name)
    return

  for _ in range(20):
    if status == win32service.SERVICE_STOPPED:
      break
    elif status != win32service.SERVICE_STOP_PENDING:
      try:
        win32serviceutil.StopService(service_name)
      except pywintypes.error:
        logging.exception("Unable to stop service '%s':", service_name)
    time.sleep(1)
    status = win32serviceutil.QueryServiceStatus(service_name)[1]

  if status == win32service.SERVICE_STOPPED:
    logging.info("Service '%s' stopped.", service_name)
    return
  elif not service_binary_name:
    return

  # Taskkill will fail on systems predating Windows XP, this is a best
  # effort fallback solution.
  output = subprocess.check_output(
      ["taskkill", "/im", "%s*" % service_binary_name, "/f"],
      shell=True,
      stdin=subprocess.PIPE,
      stderr=subprocess.PIPE)

  logging.debug("%s", output)

  # Sleep a bit to ensure that process really quits.
  time.sleep(2)
452868
def start(name):
    '''
    
    '''
    if _sd_version() >= 219:
        ret = _machinectl('start {0}'.format(name))
    else:
        cmd = 'systemctl start systemd-nspawn@{0}'.format(name)
        ret = __salt__['cmd.run_all'](cmd, python_shell=False)

    if ret['retcode'] != 0:
        __context__['retcode'] = salt.defaults.exitcodes.EX_UNAVAILABLE
        return False
    return True