class AutomateIt::ServiceManager
ServiceManager
¶ ↑
ServiceManager
provides a way of managing services, such starting and stopping Unix daemons.
Public Instance Methods
Don’t make this service
start when the computer is rebooted, but only if it’s already enabled.
# File lib/automateit/service_manager.rb, line 70 def disable(service, opts={}) dispatch(service, opts) end
Make this service
start when the computer is rebooted, but only if it’s not already enabled.
# File lib/automateit/service_manager.rb, line 66 def enable(service, opts={}) dispatch(service, opts) end
Will this service
start when the computer is rebooted?
# File lib/automateit/service_manager.rb, line 62 def enabled?(service) dispatch(service) end
Restart this service
if it’s running, or start it if it’s stopped.
Options:
-
:wait – Maxmimum seconds to wait for service to STOP.
-
:pause – Maximum seconds to wait for service to START before stopping it. Only set this if you just started the service and then decided to restart it.
# File lib/automateit/service_manager.rb, line 46 def restart(service, opts={}) dispatch(service, opts) end
Alias for started?
# File lib/automateit/service_manager.rb, line 23 def running?(service, opts={}) dispatch_to(:started?, service, opts) end
Start this service
if it’s not running.
Options:
-
:wait – Same as :wait option for
started?
-
:force – Start service without checking if it’s running.
# File lib/automateit/service_manager.rb, line 30 def start(service, opts={}) dispatch(service, opts) end
Is this service
started?
Options:
-
:wait – Maximum number of seconds to wait until service starts. Useful when a service accepts a
start
and returns immediately before the service has finished starting.
# File lib/automateit/service_manager.rb, line 12 def started?(service, opts={}) dispatch(service, opts) end
Stop this service
if it’s running.
Options:
-
:wait – Same as :wait option for
stopped?
-
:force – Stop service without checking if it’s running.
# File lib/automateit/service_manager.rb, line 37 def stop(service, opts={}) dispatch(service, opts) end
Is this service
stopped?
Options:
-
:wait – Maximum number of seconds to wait until service stops. Useful when a service accepts a
stop
and returns immediately while the service continues running for a few seconds.
# File lib/automateit/service_manager.rb, line 20 def stopped?(service, opts={}) dispatch(service, opts) end
Tell the service
to take a specific action
, e.g., “condrestart”.
# File lib/automateit/service_manager.rb, line 59 def tell(service, action, opts={}) dispatch(service, action, opts={}) end