Sha256: 7d30bff9c7e4518eed0a6222e66f7e9200492ab2c39f9fa7c921373031e0a02c
Contents?: true
Size: 1.39 KB
Versions: 6
Compression:
Stored size: 1.39 KB
Contents
module Rubyipmi::Ipmitool class Power < Rubyipmi::Ipmitool::BaseCommand def initialize(opts = ObservableHash.new) super("ipmitool", opts) end # The command function is a wrapper that actually calls the run method def command(opt) @options["cmdargs"] = "power #{opt}" value = runcmd @options.delete_notify("cmdargs") return value end # Turn on the system def on if on? return true else command("on") end end # Turn off the system def off if off? return true else command("off") end end # Power cycle the system def cycle # if the system is off turn it on if off? on else command("cycle") end end # Perform a power reset on the system def reset command("reset") end # Perform a soft shutdown, like briefly pushing the power button def softShutdown command("soft") end def powerInterrupt command("diag") end # Get the power status of the system, will show either on or off def status value = command("status") if value @result.match(/(off|on)/).to_s end end # Test to see if the power is on def on? status == "on" end # Test to see if the power is off def off? status == "off" end end end
Version data entries
6 entries across 6 versions & 1 rubygems