genode/tool/run/power_off/powerplug
2015-01-26 12:28:40 +01:00

46 lines
1.1 KiB
Plaintext

##
# Reset the target machine via powerplug
#
# \param --power-off-powerplug-ip IP address of powerplug device
# \param --power-off-powerplug-user user for powerplug device
# \param --power-off-powerplug-password password for powerplug device
# \param --power-off-powerplug-port target port of powerplug device
#
source [genode_dir]/tool/run/powerplug.inc
proc power_off_powerplug_ip { } {
return [get_cmd_arg_first --power-off-powerplug-ip 1]
}
proc power_off_powerplug_user { } {
return [get_cmd_arg_first --power-off-powerplug-user 1]
}
proc power_off_powerplug_password { } {
return [get_cmd_arg_first --power-off-powerplug-password 1]
}
proc power_off_powerplug_port { } {
return [get_cmd_arg_first --power-off-powerplug-port 1]
}
proc run_power_off { } {
set server_ip [power_off_powerplug_ip]
set user_name [power_off_powerplug_user]
set password [power_off_powerplug_password]
set power_port [power_off_powerplug_port]
set connection_id [power_plug_connect $server_ip $user_name $password]
puts "switch port $power_port off"
send -i $connection_id "port $power_port 0\n"
expect -i $connection_id "250 OK"
}