Why is this expect shell script to ssh into and reboot cisco appliances failing? -
created simple script perform reboot on cisco (telepresence) cts1300, 1000 , 3000 codecs. goal restart bunch of these units weekly through use of cron. using cygwin, , here's expect script:
#!/usr/bin/expect -f spawn ssh adminuser@123.123.123.123 expect "*?assword:*" send -- "mypassword\r" expect "*admin:*" "send -- "utils system restart\r" expect -exact "are sure want perform system restart ?\r enter \"yes\" restart system or other key abort\r continue: " send -- "yes\r" expect "*admin:*" send -- "quit\r" expect eof
the output is:
superuser@superpc ~/ctspsswd ./restartall2 spawn ssh adminuser@123.123.123.123 adminuser@123.123.123.123's password: command line interface starting up, please wait ... welcome telepresence command line interface (version 1.1) admin:utils system restart sure want perform system restart ? enter "yes" restart system or other key abort continue: s system restart has been aborted admin:quit connection 123.123.123.123 closed.
for weird reason, sends "s", aborts system restart.
i tried using #!/bin/bash
type scripting , output similar.
i tried using wild chars expect "*continue:*"
, still similar output.
i tried using autoexpect
, same exact thing happens. autoexpect script looks similar script, more specific each character typed.
i tried sending yes
after sending utils system restart, , result equivalent of \r
.
is there i'm missing? otherwise, i'll create script use interact yes
portion.
Comments
Post a Comment