Method: Chef::Provider::Service::Upstart#stop_service

Defined in:
lib/chef/provider/service/upstart.rb

#stop_serviceObject



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/chef/provider/service/upstart.rb', line 169

def stop_service
  # Calling stop on a service that is already stopped will return 1
  # Our 'goal' when we call stop is to ensure the service is stopped
  unless @upstart_service_running
    logger.trace("#{@new_resource} not running, not stopping")
  else
    if @new_resource.stop_command
      super
    else
      shell_out!("/sbin/stop #{@job}", default_env: false)
    end
  end

  @upstart_service_running = false
end