Stop a windows service

 @param [String] service_name name of the service to stop
 @param optional [Integer] timeout the minumum number of seconds to wait before timing out
765834
def stop(service_name, timeout: DEFAULT_TIMEOUT)
      Puppet.debug _("Stopping the %{service_name} service. Timeout set to: %{timeout} seconds") % { service_name: service_name, timeout: timeout }

      valid_initial_states = SERVICE_STATES.keys - [SERVICE_STOPPED]

      transition_service_state(service_name, valid_initial_states, SERVICE_STOPPED, timeout) do |service|
        send_service_control_signal(service, SERVICE_CONTROL_STOP)
      end

      Puppet.debug _("Successfully stopped the %{service_name} service") % { service_name: service_name }
    end
989943
def stop_service(self, instance, service):
        
        req = rest_pb2.EditServiceRequest()
        req.state = 'stopped'
        url = '/services/{}/{}'.format(instance, service)
        self.patch_proto(url, data=req.SerializeToString())
98469
def stop(self, name: str) -> None:
        
        if not self._timing:
            return
        now = get_now_utc_pendulum()

        # Validity check
        if not self._stack:
            raise AssertionError("MultiTimer.stop() when nothing running")
        if self._stack[-1] != name:
            raise AssertionError(
                "MultiTimer.stop({}) when {} is running".format(
                    repr(name), repr(self._stack[-1])))

        # Finish what we were asked to
        self._totaldurations[name] += now - self._starttimes[name]
        self._stack.pop()

        # Now, if we were timing something else before we started "name",
        # resume...
        if self._stack:
            last = self._stack[-1]
            self._starttimes[last] = now
307338
def stop(ctx, service, editable):
    """"""
    logger.debug("running command %s (%s)", ctx.command.name, ctx.params,
                 extra={"command": ctx.command.name, "params": ctx.params})

    home = ctx.obj["HOME"]
    service_path = plugin_utils.get_plugin_path(home, SERVICES, service, editable)

    logger.debug("loading {}".format(service))
    service = register_service(service_path)

    try:
        with open(os.path.join(service_path, ARGS_JSON)) as f:
            service_args = json.loads(f.read())
    except IOError as exc:
        logger.debug(str(exc), exc_info=True)
        raise click.ClickException("Cannot load service args, are you sure server is running?")

    # get our service class instance
    service_module = get_service_module(service_path)
    service_obj = service_module.service_class(alert_types=service.alert_types, service_args=service_args)

    # prepare runner
    runner = myRunner(service_obj,
                      pidfile=service_path + ".pid",
                      stdout=open(os.path.join(service_path, "stdout.log"), "ab"),
                      stderr=open(os.path.join(service_path, "stderr.log"), "ab"))

    click.secho("[*] Stopping {}".format(service.name))
    try:
        runner._stop()
    except daemon.runner.DaemonRunnerStopFailureError as exc:
        logger.debug(str(exc), exc_info=True)
        raise click.ClickException("Unable to stop service, are you sure it is running?")
912994
def time_out(self):
        
        _LOGGER.warning('Response timed out %s', self.session.host)
        self.stop()
        self.callback(SIGNAL_FAILED)
956794
def stop(self, timeout=None):
        
        if not timeout:
            timeout = self.timeout
        os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
        self.thread.join(timeout)
        if self.stopped:
            logging.info("OpenVPN stopped")
            if self in OpenVPN.connected_instances:
                OpenVPN.connected_instances.remove(self)
        else:
            logging.error("Cannot stop OpenVPN!")
            for line in self.notifications.split('\n'):
                logging.warn("OpenVPN output:\t\t%s" % line)
902805
def stop(self):
        
        try:
            sh.systemctl.stop(self.name)
        except sh.ErrorReturnCode_5:
            self.logger.debug('Service not running.')
1326453
def stop
      return if @state != :started
      # stop receiving new incoming messages
      @service_queue.unsubscribe
      # only stop the service if all incoming and outgoing messages are complete
      decisecond_timeout = @options[:timeout]/100
      waited_deciseconds = 0 # guarantee that this loop will stop
      while (@transactions.length > 0 || @processing_messages > 0) && waited_deciseconds < decisecond_timeout
        sleep(0.1) # wait a decisecond to check the incoming and outgoing messages again
        waited_deciseconds += 1
      end

      @channel.close
      @state = :stopped
    end
1035407
def stop_server(self):
        
        self.stop = True
        while self.task_count:
            time.sleep(END_RESP)
        self.terminate = True
736902
def stop(self, timeout=None):
        
        if timeout is not None:
            log.warning('timeout argument to stop() is deprecated - '
                        'it will be removed in future release')

        if not self.async_send:
            log.warning('producer.stop() called, but producer is not async')
            return

        if self.stopped:
            log.warning('producer.stop() called, but producer is already stopped')
            return

        if self.async_send:
            self.queue.put((STOP_ASYNC_PRODUCER, None, None))
            self.thread_stop_event.set()
            self.thread.join()

        if hasattr(self, '_cleanup_func'):
            # Remove cleanup handler now that we've stopped

            # py3 supports unregistering
            if hasattr(atexit, 'unregister'):
                atexit.unregister(self._cleanup_func)  # pylint: disable=no-member

            # py2 requires removing from private attribute...
            else:

                # ValueError on list.remove() if the exithandler no longer exists
                # but that is fine here
                try:
                    atexit._exithandlers.remove(  # pylint: disable=no-member
                        (self._cleanup_func, (self,), {}))
                except ValueError:
                    pass

            del self._cleanup_func

        self.stopped = True
18000
function stopTimeout(ctx) {
  assert(ctx);
  if (ctx.timer != null) {
    clearTimeout(ctx.timer);
    ctx.timer = null;
  }
  ctx.stopped = true;
}
730608
def resume(service_name, timeout: DEFAULT_TIMEOUT)
      Puppet.debug _("Resuming the %{service_name} service. Timeout set to: %{timeout} seconds") % { service_name: service_name, timeout: timeout }

      valid_initial_states = [
        SERVICE_PAUSE_PENDING,
        SERVICE_PAUSED,
        SERVICE_CONTINUE_PENDING
      ]

      transition_service_state(service_name, valid_initial_states, SERVICE_RUNNING, timeout) do |service|
        # The SERVICE_CONTROL_CONTINUE signal can only be sent when
        # the service is in the SERVICE_PAUSED state
        wait_on_pending_state(service, SERVICE_PAUSE_PENDING, timeout)

        send_service_control_signal(service, SERVICE_CONTROL_CONTINUE)
      end

      Puppet.debug _("Successfully resumed the %{service_name} service") % { service_name: service_name }
    end
125006
def stop(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The start action must be called with -a or --action.'
        )

    log.info('Stopping node %s', name)

    return vm_action(name, kwargs={'action': 'stop'}, call=call)
1083161
def get_timeout(service):
    
    custom_timeout_key = "RESTCLIENTS_%s_TIMEOUT" % service.upper()
    if hasattr(settings, custom_timeout_key):
        return getattr(settings, custom_timeout_key)

    default_key = "RESTCLIENTS_DEFAULT_TIMEOUT"
    if hasattr(settings, default_key):
        return getattr(settings, default_key)

    return OLD_DEFAULT_TIMEOUT
30356
def stop(name):
    '''
    
    '''
    if not exists(name):
        raise ContainerNotExists("The container (%s) does not exist!" % name)
    cmd = ['lxc-stop', '-n', name]
    subprocess.check_call(cmd)
336653
public void serviceName_zone_name_terminate_POST(String serviceName, String name) throws IOException {
		String qPath = "/ipLoadbalancing/{serviceName}/zone/{name}/terminate";
		StringBuilder sb = path(qPath, serviceName, name);
		exec(qPath, "POST", sb.toString(), null);
	}
336512
def _stop_instance(self):
        """"""
        instance = self._get_instance()
        instance.stop()
        self._wait_on_instance('stopped', self.timeout)