Hello all,

I have a script that is checking a service to see if its running and that its log file does not contain two error message to confirm that it has not died. However the subrutine is just saying its up when I have put the error message in the last line of the log to make sure it sees that its down. Please have a look at the code snipit and any help would be great.

Thanks,

Tim

sub grepstring {
open LOG, "tail gw_20050105.log |", or die "Log file not found $!";
while (<LOG>) {
$newlog = <LOG>;
if ($newlog =~ /^Read failed on socket/ || /^EFIXException::/) {
exit $exit_codes{'CRITICAL'};
print "Log entry can not be found GW down!\n";
} else {
print "GW is UP!\n";
exit $exit_codes{'OK'};
}
} }


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to