My script telnets to a list of routers in a text file (one by one), and issues a command to each router. The problem is, when it gets to a router that is unreachable, the script simply hangs and I have to figure out where it hung, and remove that router's IP address from the text file. Then I have to start the script again from where it left off. First, I would like the script to move on to the next router in the list, even if it gets hung up on a non-existent router. Second, it would be nice if the script could output the failures to a file that I could read later. I think I can do this with some kind of command that tells Procomm to move on to the next router if it doesn't get a response in 10 sec. or so. Not sure though. Here's what I have currently:
proc main
string szFname = "C:\routers.txt"
if fopen 0 szFname READ TEXT
while not feof 0
fgets 0 szLine
LoopbackIP = szLine
strcat LoopbackIP ".1"
connectmanual telnet LoopbackIP
waitfor "Password: "
transmit "mypwd^M"
waitfor ">"
transmit "en^M"
waitfor "Password: "
transmit "myenablepwd^M"
waitfor "#"
transmit "show ip eigrp neigh^M"
waitfor "#"
transmit "quit^M"
endwhile ;stops the loop
fclose 0 ;close the file
else
errormsg "Couldn't open c:\routers.txt !"
endif
endproc
proc main
string szFname = "C:\routers.txt"
if fopen 0 szFname READ TEXT
while not feof 0
fgets 0 szLine
LoopbackIP = szLine
strcat LoopbackIP ".1"
connectmanual telnet LoopbackIP
waitfor "Password: "
transmit "mypwd^M"
waitfor ">"
transmit "en^M"
waitfor "Password: "
transmit "myenablepwd^M"
waitfor "#"
transmit "show ip eigrp neigh^M"
waitfor "#"
transmit "quit^M"
endwhile ;stops the loop
fclose 0 ;close the file
else
errormsg "Couldn't open c:\routers.txt !"
endif
endproc