| |||||||||||
Control Multiple Spawn telnetthrough single script Posted by mansoorx (mansoorx), 15 March 2006 Hello, I am trying to develope a programme, through which i can access two different Cisco Switch at the same time and open its port no 23, but when i execute this script it does not display any message and i press "Crtl + c " to come back in Linux command promt. #!/usr/bin/expect -f set switch {192.168.0.3 192.168.0.4} set running 0 log_user 0 foreach x $switch { spawn telnet $x expect -i $x "Username:" send -i $x "name\r" expect -i $x "Password:" send -i $x "password\r" expect -i ">" send -i $x "enable\r" expect -i $x "Password:" send -i $x "password\r" expect -i $x "#" send -i $x "conf t" expect -i $x "#" send -i $x "int fas 0/23\r" expect -i $x "#" send -i $x "no sh\r" expect -i $x "#" send -i $x "do wr" expect -i $x "#" send -i $x "do exit\r" } Thank You Advanced. Posted by admin (Graham Ellis), 15 March 2006 It's probably hanging up someehere in the send and expect sequence - probably a tiny error in your choreography. And as you've not got any puts statements anywhere in your code, there's no output at all so you're not being given any clues!As a first step, I would remove the log_user 0 so that all the protocol exchanges will be echoed on the screen. That way' you'll see where it comes to a halt. Posted by mansoorx (mansoorx), 16 March 2006 I just remove the log_user 0 and run it again but again it take almost 4 minut to execute but, port 23 is not configured at all , and display in that format ,in linux this script after excution, [mansoor@tech mansoor]$ ./mspawn spawn telnet 192.168.0.9 spawn telnet 192.168.0.47 [mansoor@tech mansoor]$ Posted by admin (Graham Ellis), 16 March 2006 Then your problem lies at the very beginning with the spawn ... it's not getting any login offer back so you're having a timeout at each and every stage. Try running the telnet from a shell and see what's happening.Posted by mansoorx (mansoorx), 1 April 2006 Hello Graham,Sorry for delay, due to some reasons, any when i telnet from shell it work very well, but whenever i run this script spawn takes time, and dont implement any configuration on the switches. Posted by admin (Graham Ellis), 1 April 2006 .... and having now run it from telnet, look and see exactly what the difference are and that should lead you in the right direction ...This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |