Hello,
    I am writing a script on a linux server use Net::SSH::Perl.  Every
once in a while the ssh connection to a remote server dies or it just
can't connect.  the perl module send a $SIG{KILL} to the script when
ever this happens.  Which isn't what I want.  I am trying to put the
kill in an eval stattement and have it wait a few minutes before it
tries to connect again.  But I am never getting past the eval statement.

Here's my code:

 eval  { local $SIG{KILL} = sub {die "died" };        
                alarm 10;
                $ssh->login($user);
                ($out, $error, $exit) = $ssh->cmd($cmd);
                alarm(0);
        }; # end of eval statement        
        if ($@ =~ /died/) {
               try_again($host_ip, $host_name, $group_dir) = @_;
        }        

It the try_again sub I have it email me (which works) but I have it
print that it's entering the failed subroutine but it never does that.

  Does anyone see what I am doing wrong?  Thanks again for all the help.

--chad  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to