| 1 |
#! /usr/bin/expect -- |
| 2 |
# |
| 3 |
# Reboot a machine connected to an ACS48 terminal server which is appropriately |
| 4 |
# configured to use power management equipment. Assumes that ^P is power menu |
| 5 |
# hotkey (this is the default). |
| 6 |
# |
| 7 |
# Copyright 2006 Google Inc. |
| 8 |
# Author: [email protected] (Salman Qazi) |
| 9 |
# |
| 10 |
set machine [lindex $argv 0] |
| 11 |
set ts_addr [lindex $argv 1] |
| 12 |
spawn ssh root:$machine@$ts_addr |
| 13 |
sleep 5 |
| 14 |
set timeout 10 |
| 15 |
expect { |
| 16 |
"Enter your option :" { |
| 17 |
send "4\r" |
| 18 |
expect { |
| 19 |
"Enter session PID or \'all\':" { |
| 20 |
send "all\r" |
| 21 |
} |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
expect { |
| 26 |
"All sessions killed." { |
| 27 |
send \020 |
| 28 |
expect { |
| 29 |
"Please choose an option:" { |
| 30 |
send "5\r" |
| 31 |
expect { |
| 32 |
"Outlet turned on." {send "\r~.\r"} |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
} |
| 38 |
} |
| 39 |
|