Class AutomateIt::ServiceManager
In: lib/automateit/service_manager.rb
Parent: AutomateIt::Plugin::Manager

ServiceManager

ServiceManager provides a way of managing services, such starting and stopping Unix daemons.

Methods

Public Instance methods

Don‘t make this service start when the computer is rebooted, but only if it‘s already enabled.

Make this service start when the computer is rebooted, but only if it‘s not already enabled.

Will this service start when the computer is rebooted?

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.

Alias for started?

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.

Start and enable the service using start and enable.

If is_restart, restart the service, otherwise start it.

Example:

 modified = edit "/etc/myapp.conf" {#...}
 service_manager.start_or_restart("myapp", modified)

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.

Stop this service if it‘s running.

Options:

  • :wait — Same as :wait option for stopped?
  • :force — Stop service without checking if it‘s running.

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.

Tell the service to take a specific action, e.g., "condrestart".

[Validate]