Module: Machines::Commands::Services

Included in:
Machines::Core
Defined in:
lib/machines/commands/services.rb

Instance Method Summary collapse

Instance Method Details

#restart(daemon) ⇒ Object

Restart a daemon

Parameters:

  • daemon (String)

    Name of the service to restart



21
22
23
# File 'lib/machines/commands/services.rb', line 21

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)



14
15
16
17
# File 'lib/machines/commands/services.rb', line 14

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

#stop(daemon) ⇒ Object

Stop a daemon

Parameters:

  • daemon (String)

    Name of the service to stop



6
7
8
# File 'lib/machines/commands/services.rb', line 6

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