class Rubyipmi::Freeipmi::Power

Public Class Methods

new(opts = ObservableHash.new) click to toggle source
Calls superclass method Rubyipmi::BaseCommand.new
# File lib/rubyipmi/freeipmi/commands/power.rb, line 4
def initialize(opts = ObservableHash.new)
  super("ipmipower", opts)
end

Public Instance Methods

command(opt) click to toggle source

The command function is a wrapper that actually calls the run method

# File lib/rubyipmi/freeipmi/commands/power.rb, line 9
def command(opt)
  @options[opt] = false
  value = runcmd
  @options.delete_notify(opt)
  return @result
end
cycle() click to toggle source

Power cycle the system

# File lib/rubyipmi/freeipmi/commands/power.rb, line 27
def cycle
  # if the system is off turn it on
  if off?
    on
  else
    command("cycle")
  end

end
off() click to toggle source

Turn off the system

# File lib/rubyipmi/freeipmi/commands/power.rb, line 22
def off
  command("off")
end
off?() click to toggle source

Test to see if the power is off

# File lib/rubyipmi/freeipmi/commands/power.rb, line 65
def off?
  status == "off"
end
on() click to toggle source

Turn on the system

# File lib/rubyipmi/freeipmi/commands/power.rb, line 17
def on
  command("on")
end
on?() click to toggle source

Test to see if the power is on

# File lib/rubyipmi/freeipmi/commands/power.rb, line 60
def on?
  status == "on"
end
powerInterrupt() click to toggle source
# File lib/rubyipmi/freeipmi/commands/power.rb, line 47
def powerInterrupt
  command("pulse")
end
reset() click to toggle source

Perform a power reset on the system

# File lib/rubyipmi/freeipmi/commands/power.rb, line 38
def reset
  command("reset")
end
softShutdown() click to toggle source

Perform a soft shutdown, like briefly pushing the power button

# File lib/rubyipmi/freeipmi/commands/power.rb, line 43
def softShutdown
  command("soft")
end
status() click to toggle source

Get the power status of the system, will show either on or off

# File lib/rubyipmi/freeipmi/commands/power.rb, line 52
def status
  value = command("stat")
  if value
    @result.split(":").last.chomp.strip
  end
end