blob: d84331c74050d3a3e7123102068cd8e1b89bf5ea [file] [log] [blame]
mblighe13c1492007-01-29 00:59:48 +00001#! /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: sqazi@google.com (Salman Qazi)
9#
10set machine [lindex $argv 0]
11set ts_addr [lindex $argv 1]
12spawn ssh root:$machine@$ts_addr
13sleep 5
mblighe8631d02007-01-29 01:03:40 +000014set timeout 10
mblighe13c1492007-01-29 00:59:48 +000015expect {
16 "Enter your option :" {
17 send "4\r"
18 expect {
19 "Enter session PID or \'all\':" {
20 send "all\r"
21 }
22 }
23 }
24}
25expect {
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