Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2nd telnet attempt ?

Status
Not open for further replies.

fonejack

Technical User
Mar 6, 2007
65
0
0
US
I have a very simple script to set the time on my CSUs but I have a problem when telnetting to them. The first telnet attempt sometimes fails but always works on the second try. Is there a way to repeat the connectmanual TELNET command if it does not see the waitfor "password:^M^J"?

Much appreciated



proc main
connectmanual TELNET "XXX.XXX.XXX.XXX"
transmit "^M"
waitfor "password:^M^J"
transmit "XXXXXX^M"
waitfor " MM> "
pause 1
transmit "eps: XXXXXX^M"
pause 3
transmit "st:"
transmit $Time24
transmit "^M"
pause 1
transmit "^d"
 
What you can do is make the waitfor "password" command in your script into an if not waitfor command, then add the second call to connectmanual in it, like this:

if not waitfor "password:^M^J"
connectmanual TELNET "XXX.XXX.XXX.XXX"
transmit "^M"
else
the remainder of your script goes here
endif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top