This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need help running expect script under CYGWIN...


Hi, much thanks in advance for any and all help anyone can provide.  

I'm by no means a scripting/*NIX/Expect guru - but a while back was able to
stumble  through setting up Windows/CYGWIN/expect enough to put together a
really functional system for basic network management of Cisco routers and
switches.  Everything ran fine on my old laptop which died recently.  I've
just downloaded the latest CYGWIN to my new laptop (I'm assuming a newer
version since last July) and none of my scripts will work any longer.  They
are very basic - essentially they just spawn telnet to a host and do what's
in the script.  It appears that with the current version of CYGWIN (or the
expect that runs in it) the spawn sessions are dying early.  I've scoured
the internet for help, but while there are several people in my same boat -
I'm not finding any solutions.  Attached below is my error message, my
expect script, and my (simple) shell script that pipes in a list of
names/IPs as arguments to expect.

I really relied on this to manage a large number of switches in the past and
am really hurting not having this - thanks for any input at all.

-Calvin

ERROR:
=================================

Spawn telnet pn-abrams-switch
Send: invalid spawn id (4)

EXPECT SCRIPT:
=================================

set timeout 20
set USER_NAME "XXXXX"
set USER_PASS "XXXXXX"
set ENABLE_PASS "XXXXXX"
set ROUTER $argv
spawn telnet $ROUTER 
expect "Username: "
send "$USER_NAME\r"
expect "Password: "
send "$USER_PASS\r"
expect "#$"
send "term length 0\r"
expect "#$"
log_file ./output/$ROUTER-show_run.txt
send "sh run | include hostname\r"
expect "#$"
send "\r"
expect "#$"
send "\r"
expect "#$"
send "sh run"
expect "#$"
send "\r"
expect "#$"
log_file
send "exit\r"

SHELL SCRIPT:
===================================

for ROUTER in `cat names.txt`; do ./expect-BABW-show_run.txt $ROUTER; done

-- 
View this message in context: http://www.nabble.com/Need-help-running-expect-script-under-CYGWIN...-tf1874435.html#a5124210
Sent from the Cygwin Users forum at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]