> -----Original Message-----
> From: Chad Kellerman [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 27, 2002 8:58 AM
> To: [EMAIL PROTECTED]
> Subject: Re: eval on a $SIG{KILL}- newbie question
> 
> 
> Bob,
>     Thanks for the responce.  I did not realize you can't trap a
> $SIG{kill}.
> 
>      I guess the only way around this is to change the perl module. 
> Change it so it doesn't die but return a value and grab that value in
> the eval statement?

Wait a minute. die() is vastly different from sending SIGKILL. If the module
simply die()'s, you catch that by examining $@ after the eval block.

> 
> 
> thanks again,
> --chad
> 
> 
> On Tue, 27 Aug 2002 08:41:31 -0400
> Bob Showalter <[EMAIL PROTECTED]> wrote:
> 
> > > -----Original Message-----
> > > From: Chad Kellerman [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, August 27, 2002 8:33 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: eval on a $SIG{KILL}- newbie question
> > > 
> > > 
> > > 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.
> > 
> > Are you saying Net::SSH::Perl sends SIGKILL to the calling 
> script? You
> > can't catch SIGKILL. 
> > 
> > If you're trying to catch the 10 second timeout, use $SIG{ALRM}.
> > 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to