Module: Machines::Services

Defined in:
lib/machines/services.rb

Instance Method Summary collapse

Instance Method Details

#restart(daemon) ⇒ Object

Restart a daemon

Parameters:

  • daemon (String)

    Name of the service to restart



19
20
21
# File 'lib/machines/services.rb', line 19

def restart daemon
  Command.new("service #{daemon} restart", check_daemon(daemon))
end

#start(daemon, options = {}) ⇒ Object

Start a daemon

Parameters:

  • daemon (String)

    Name of the service to start

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :check (Boolean)

    Set to false to disable the check (e.g. start hostname, :check => false)



12
13
14
15
# File 'lib/machines/services.rb', line 12

def start daemon, options = {}
  check = options[:check] || check_daemon(daemon)
  Command.new("service #{daemon} start", check)
end

#stop(daemon) ⇒ Object

Stop a daemon



4
5
6
# File 'lib/machines/services.rb', line 4

def stop daemon
  Command.new("service #{daemon} stop", check_daemon(daemon, false))
end