| #!/usr/bin/expect -- |
| # |
| # Reboot a machine connected to an APC power strip |
| # |
| # Copyright 2007 Google Inc., Martin J. Bligh <mbligh@google.com> |
| |
| set ip_addr [lindex $argv 0] |
| set port [lindex $argv 1] |
| |
| spawn telnet $ip_addr |
| |
| set timeout 10 |
| |
| expect "User Name :" |
| send "apc\r" |
| expect "Password :" |
| send "apc\r" |
| expect "1- Device Manager" |
| expect "> " |
| send "1\r" |
| expect "3- Outlet Control/Configuration" |
| expect "> " |
| send "3\r" |
| expect "Press <ENTER> to continue..." |
| send "\r" |
| expect "> " |
| send $port |
| send "\r" |
| expect "1- Control Outlet" |
| expect "> " |
| send "1\r" |
| expect "3- Immediate Reboot" |
| expect "> " |
| send "3\r" |
| expect "Immediate Reboot" |
| expect "Enter 'YES' to continue or <ENTER> to cancel :" |
| send "YES\r" |
| expect "Press <ENTER> to continue..." |