From: Robin L. P. <rlp...@di...> - 2009-06-08 17:05:19
|
On Sun, Jun 07, 2009 at 10:08:25PM -0700, 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 is a terminal emulator; it passes \cC to the remote side. Try it on the command line; you'll see it doesn't work (assuming a connection has been made). Try \c] followed by "exit" (or whatever command your telnet wants; do ^] on a live connection by hand to see the menu). -Robin |