From: Ian M. <iw...@do...> - 2009-06-09 13:23:02
|
Pothuri, Satish K wrote: > Hi, > > > > I would appreciate if someone can help me with this. > > > > I am writing a script in Perl that uses expect feature to SSH to a > server and perform ping and telnet tests from that server. > > > > 1. Spawn SSH to a server > 2. Send commands for ping and telnet (one after another) to the > spawned command (SSH). > > > > My question is how I can interrupt/terminate the telnet process if it is > taking too long to complete. I am trying to send “\cC” (control – C) if > my expect times out waiting for something after sending the telnet > command, but it doesn’t seem to be working. > > Telnet and ssh both support escape characters which can specified on the command line. Providing the escape characters for ssh and telnet are different, send the telnet escape, when you get the telnet prompt send the telnet command quit to close the connection and exit telnet. Ian |