Subject: RE: Script question
From: Leif Sawyer (lsawyer@gci.com)
Date: Fri Jan 30 2004 - 15:38:39 AKST
Jeff Hassler writes:
> I have a database listener that crashes now and then. I can check
> the status with a "lsnrctl status" command; if it doesn't come
> back, I know the listener locked up. So, how do I set up a script
> to detect that the command has not returned after maybe 30 seconds?
Jeff, I use a perl script to perform nearly the same thing:
(note that this requires the Session.pm from a newish MRTG distro)
#!/usr/local/bin/perl
if ( $#ARGV < 0 ) {
print "$0 host\n";
exit 1;
}
my $host = $ARGV[0];
my $CMD=qq|ssh $host "echo host-ok"|;
require '/usr/local/mrtg/bin/Session.pm';
# Why does SSH take nearly 4 minutes to time out on a connection?
my $session = new IPC::Session($CMD, 30) || die "Can't open new
IPC::Session for '$CMD'\n";
$session->send("echo host-ok"); # Seems to be a bug that the
command passed doesn't always execute...
my $response = $session->stdout();
print "$response";
}
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
This archive was generated by hypermail 2a23 : Fri Jan 30 2004 - 15:38:43 AKST