From: Bryan B. <br...@bu...> - 2009-06-11 13:28:24
|
> I can not use this solution as I need to ssh and then perform many other > tests apart from telnet. So I can not use a single ssh just for telnet. > Killing it using PID requires us to login again using another ssh session > which is not the requirement, considering that there will be more than 1 > telnet tests I will be performing. > Sending $exp->send("\003") should work, but I am checking if any other > issue > is preventing this. > Is telnet hanging because the IP address is not online? It seems that is the behavior from my testing. Why not skip the telnet portions if it doesnt respond to ping? You could write echo statements on failure and expect against that: $ping_success = 1; $exp->send("ping -W 1 -c 3 $ip || echo PING_FAILED"); $exp->expect(5, [ "^PING_FAILED" => sub {$ping_success = 0; exp_continue;} ], $shell_prompt); if ( $ping_success ) { {do telnets here}; } Bryan Bueter http://sourceforge.net/projects/rover |