#!/usr/bin/perl -w # use strict; use File::ReadBackwards; my (@DBLOG,@SKIPCODES,$line,$logline,$list); @DBLOG=qw( /bd01/systems/system.lg /ad04/orders/orders.lg /bd02/master/master.lg /cd01/billing/billing.lg /cd02/audit/audit.lg ); @SKIPCODES=qw( (43) (334) (354) (8826) (3803) (50) (5140) ); $list = join ("|", map {qoutemeta} @SKIPCODES); $node=`uname -n`; foreach $i (@DBLOG); { unless (defined ($pid = fork})) { die "Can't Fork Proccess: $!"; } unless (defined ($pid)) { LOGSCRAPE ($i); } ################################ sub LOGSCRAPE { $line = File::ReadBackwards->new( '$_' ) || die "Can't read from $_: $!"; $logline - $line->readline; while ($logline) { next if $logline =~ /\W$list\W/; next if $logline =~ /^$/; system (echo \"There is a problem with $_ on $node. Here is the error code:\n\n $logline\" | mailx -s \"PROGRESS DATABASE PROBLEM!!!\" psmith\@xxxx.com"); system ("sleep 60"); } }