delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/30/13:42:19

X-Spam-Check-By: sourceware.org
Message-ID: <5124210.post@talk.nabble.com>
Date: Fri, 30 Jun 2006 10:41:25 -0700 (PDT)
From: cledford <ledfordc AT fauquierhospital DOT org>
To: cygwin AT cygwin DOT com
Subject: Need help running expect script under CYGWIN...
MIME-Version: 1.0
X-Nabble-Sender: ledfordc AT fauquierhospital DOT org
X-Nabble-From: cledford <ledfordc AT fauquierhospital DOT org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019