Class: Upstart
- Inherits:
-
ServiceManager
- Object
- ServiceManager
- Upstart
- Defined in:
- lib/resources/service.rb
Overview
@see: upstart.ubuntu.com
Instance Attribute Summary
Attributes inherited from ServiceManager
Instance Method Summary collapse
- #info(service_name) ⇒ Object
-
#initialize(service_name, service_ctl = nil) ⇒ Upstart
constructor
A new instance of Upstart.
Constructor Details
#initialize(service_name, service_ctl = nil) ⇒ Upstart
Returns a new instance of Upstart.
216 217 218 219 |
# File 'lib/resources/service.rb', line 216 def initialize(service_name, service_ctl = nil) @service_ctl ||= 'initctl' super end |
Instance Method Details
#info(service_name) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/resources/service.rb', line 221 def info(service_name) # get the status of upstart service status = inspec.command("#{service_ctl} status #{service_name}") # fallback for systemv services, those are not handled via `initctl` return SysV.new(inspec).info(service_name) if status.exit_status.to_i != 0 # @see: http://upstart.ubuntu.com/cookbook/#job-states # grep for running to indicate the service is there running = !status.stdout[%r{start/running}].nil? { name: service_name, description: nil, installed: true, running: running, enabled: info_enabled(status, service_name), type: 'upstart', } end |