I am using Net::Telnet to access from one machine to another where I work. I am using it to monitor some processes so it can send me a message if there is a problem. Today, the script exited without warning me because it timed out waiting for a response from the remote machine. How can I trap that exit so that it sends me a message as it kills the script?
$t=new Net::Telnet (Timeout->10,prompt=>'/hello.*/');
$t->open($machine);
$t->login($user,$pass);
$t->cmd("some command");
It normally works, I have had it run for 12 hours at a time without having a timeout problem in the past, I have only seen it timeout on "some command" once, but I want it to notify if it does. I already have the process in place notify if only I knew how to call it on a timout.
Thanx,
-Kevin