#!/usr/bin/perl require "sendmail.pl"; use Win32; $SName = Win32::NodeName(); $Pfad = "D:\\ADMIN\\rman\\logs"; $Log_Name = "BACKUP_XX_ARCH.LOG"; @logfiles = qw/"BACKUP_XX_ARCH.log" "BACKUP_XX_FULL.LOG"/; $bodyfile = "D:\\admin\\perl\\temp\\RBL.txt"; $Fehler = 0; my @errors; foreach my $Log_Name (@logfiles) { if (-f $Log_Name) { my $mtime = ($Writetime) = (stat(@logfiles))[8,9]; if $Writetime = open(InFile,"$Pfad\\".$Log_Name); while() { $Text .= $_; } close(InFile); $Text =~ /(ERROR)/g; if ($1 eq "ERROR") { $Fehler = 1; $Fehler_Text .= $Text; , push @errors, $Text; } else { $Fehler_Text .= "Check RMAN-Log OK!\n"; } } else { push @errors, "Log $Log_Name nicht von heute\n"; } if (@errors) { open (FO,">$bodyfile"); print FO @errors."\n"; close(FO); print "$Fehler_Text"; sendmail("RMAN_Error",$bodyfile); exit 999; } else { sendmail("RMAN_OK",$bodyfile); }