Operating System - HP-UX
1849542 Members
6327 Online
104044 Solutions
New Discussion

Telnet from NClass to router and execute script

 
SOLVED
Go to solution
Robb Bailey
Occasional Advisor

Telnet from NClass to router and execute script

I need to telnet from my NClass to a router, login, execute a few commands, and exit. I can connect to the router via IP but it seems that I lose control of the session at that point. No line in my script beyond the telnet IP command executes. When the password times out and control returns to the NClass, the rest of the script executes. This is the sequence of my script.

telnet IP address
password
router name> en
password
command1
command2
command3
exit

How do I get the rest of my script to actually execute on the router?

Thank you very much for your help.

Robb
3 REPLIES 3
harry d brown jr
Honored Contributor

Re: Telnet from NClass to router and execute script

Sridhar Bhaskarla
Honored Contributor
Solution

Re: Telnet from NClass to router and execute script

Hi Robb,

We had a discussion on this sometime back. I would suggest to use expect/TCL-TK as non-interactive telnet is not very reliable due to timing issues.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x54e2c6af36b7d5118ff10090279cd0f9,00.html

It's not very difficult to write an expect script. There are plenty of examples the come with it.

http://hpux.ee.ualberta.ca/hppd/hpux/Tcl/expect-5.31/

Check out the dependencies. You need to download TCL/TK also.

-Sri

You may be disappointed if you fail, but you are doomed if you don't try
Uday_S_Ankolekar
Honored Contributor

Re: Telnet from NClass to router and execute script

Hi,

Try using 'expect'
You can download it from here..

http://hpux.ee.ualberta.ca/hppd/hpux/Tcl/expect-5.31/

-USA..
Good Luck..