49 lines
991 B
Plaintext
Executable File
49 lines
991 B
Plaintext
Executable File
#! /usr/sgitcl/bin/expect
|
|
|
|
# This script will execute a command on the remote machine. By default
|
|
# the command is in the root directory. It's useful for things like
|
|
# xp_switch, xp_neton, etc.
|
|
# Written by Jason Hunter
|
|
|
|
# check we have a parameter
|
|
set argc [llength $argv]
|
|
if {$argc < 1} {
|
|
send_error "Example usage: $argv0 xp_switch\n"
|
|
exit
|
|
}
|
|
|
|
log_file -a xp_do.log
|
|
|
|
set arg0 [lindex $argv 0]
|
|
|
|
if {
|
|
[string match $arg0 xp_neton] != 1 &&
|
|
[string match $arg0 xp_netoff] != 1 &&
|
|
[string match $arg0 xp_switch] != 1 &&
|
|
[string match $arg0 xp_stop] != 1 &&
|
|
[string match $arg0 xp_acceptance] != 1 &&
|
|
[string match $arg0 xp_aim] != 1 } {
|
|
send_error "Example usage: $argv0 xp_switch\n"
|
|
exit
|
|
}
|
|
|
|
source script.exp
|
|
|
|
set timeout -1
|
|
for {} {1} {} {
|
|
spawn cu -l /dev/ttyd2
|
|
expect {
|
|
"Connect failed: DEVICE LOCKED" {sleep 60}
|
|
"Connected" {break}
|
|
default {break}
|
|
}
|
|
}
|
|
set timeout 60
|
|
|
|
2u_root
|
|
|
|
send "/$arg0 \r"
|
|
|
|
set timeout 90
|
|
expect -re "# $" {exit}
|