# File lib/rubyipmi/ipmitool/commands/power.rb, line 5 def initialize(opts = ObservableHash.new) super("ipmitool", opts) end
The command function is a wrapper that actually calls the run method
# File lib/rubyipmi/ipmitool/commands/power.rb, line 10 def command(opt) @options["cmdargs"] = "power #{opt}" value = runcmd @options.delete_notify("cmdargs") return value end
Power cycle the system
# File lib/rubyipmi/ipmitool/commands/power.rb, line 36 def cycle # if the system is off turn it on if off? on else command("cycle") end end
Turn off the system
# File lib/rubyipmi/ipmitool/commands/power.rb, line 27 def off if off? return true else command("off") end end
Test to see if the power is off
# File lib/rubyipmi/ipmitool/commands/power.rb, line 75 def off? status == "off" end
Turn on the system
# File lib/rubyipmi/ipmitool/commands/power.rb, line 18 def on if on? return true else command("on") end end
Test to see if the power is on
# File lib/rubyipmi/ipmitool/commands/power.rb, line 69 def on? status == "on" end
# File lib/rubyipmi/ipmitool/commands/power.rb, line 56 def powerInterrupt command("diag") end
Perform a power reset on the system
# File lib/rubyipmi/ipmitool/commands/power.rb, line 47 def reset command("reset") end
Perform a soft shutdown, like briefly pushing the power button
# File lib/rubyipmi/ipmitool/commands/power.rb, line 52 def softShutdown command("soft") end
Get the power status of the system, will show either on or off
# File lib/rubyipmi/ipmitool/commands/power.rb, line 61 def status value = command("status") if value @result.match(/(off|on)/).to_s end end