Results 1 to 1 of 1
Hello All,
I wrote the following script to collect the output of around 15 commands from from Cisco routers and switches. However, its getting terminated before completing all the commands. ...
- 11-09-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 1
Script to collect data from Cisco router getting terminated
Hello All,
I wrote the following script to collect the output of around 15 commands from from Cisco routers and switches. However, its getting terminated before completing all the commands. sometimes the session is getting closed after executing the first command. What could be wrong? thanks in advance!
Cheers,Code:#!/usr/bin/expect -f #! /bin/bash # set force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg } } set timeout 20 log_user 1 set var1 [lindex $argv 0 ] puts $var1 spawn telnet $var1 expect "*sername: " send -- "foo\r" expect "*assword: " send -- "bar\r" log_user 1 expect "*>" send "en\r" expect "*assword: " send -- "foo\r" expect "*#" send -- "term len 0\r" expect "*#" send -- "sh run\r" expect "*#" send -- "sh env all\r" expect "*#" send -- "show environment status all\r" expect "*#" send -- "sh mod\r" expect "*#" send -- "show version\r" expect "*#" send -- "sh ip int brief\r" expect "*#" send -- "sh cdp nei\r" expect "*#" send -- "sh etherchannel summary\r" expect "*#"
Kriz


Reply With Quote