I have the following script that works ok with one excpetion, It terminates prematurely. How do I tell the script to wait until the device is done doing its thing ?
#!/usr/local/bin/expect --
#log_user 0
#exp_internal 1
#spawn $env(SHELL)
#log_file -noappend logit
puts "[exec clear]"
#set nam "[ clock format [ clock seconds ] -format "%m%d%H%M" ].log"
set nam "[ lindex $argv 0 ].iospushlog"
log_file -a $nam
#
spawn telnet
expect "telnet>"
send "open [lindex $argv 0]\n"
expect "e: "
send "xxxx\n"
expect "d: "
send "yyyyy\n"
expect ">"
send "ena\n"
expect "d: "
send "xxxxxxx\n"
#expect ">"
expect "#"
send "copy tftp flash\n"
expect "host []?"
send "16.17.71.13\n"
expect "filename []?"
send "c1700-adventerprisek9-mz.123-20.bin\n"
expect "]? "
send "\n"
expect "confirm]"
send "n \n"
expect "#"
The ouput is
spawn telnet
telnet> open 10.204.143.255
Trying 10.204.143.255...
Connected to 10.204.143.255.
Escape character is '^]'.
*******************************************
* !! UNAUTHORIZED ACCESS PROHIBITED !! *
User Access Verification
Username: xxxxxx
Password:
bs6c053p1>ena
bs6c053p1#copy tftp flash
Address or name of remote host []? 16.17.71.13
Source filename []? c1700-adventerprisek9-mz.123-20.bin
Destination filename [c1700-adventerprisek9-mz.123-20.bin]?
Accessing tftp://146.170.71.103/c1700-adventerprisek9-mz.123-20.bin...
Erase flash: before copying? [confirm]n
!!!!!!!!!!!
The script starts a tftp xfer. It will take time, maybe hours, for the tftp xfer to terminate.
How can I keep Expect from exiting prematurely.
Thanks