#!/usr/local/bin/perl # use Sys::Hostname; use Net::SMTP; use File::Find::Rule; # Paramter für Mail Versand #----------------------------- $SID = ; $local_host = hostname(); $mailServer = ""; $from = "$ABSENDER\@$local_host"; $to = "Test@TEST.de"; my $output = "F:\\temp\\out\\output.txt"; my $directory = "F:\\Ziel\\log"; my $timelimit = time - (60 * 15); my @files = File::Find::Rule->file() # Rückgabe aller Files < 15min ->mtime( ">$timelimit" ) ->in( $directory ); if (@files[0] ne '' ) #Wenn Array ungleich "leer" dann "Installer läuft" { printf "Alles Gut/n"; } else { printf "Pruefen/n"; open(DATA,"F:\\\\log\\Console.log"); $newline = 1; for ($i=-1; seek(DATA,$i,2); $i--) { read DATA,$char,1; if ($char eq "\n") {$i--; $newline++;} last if ($newline > 20); $string = $char.$string; } close(DATA); @last20lines = split(/\n/, $string); printf "============="; printf "@last20lines"; printf "============="; open (DATEI, ">>$output") or die $!; print DATEI "@last20lines"; close (DATEI); #E-Mail Benachrichtigung $smtp = Net::SMTP->new($mailServer); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: SUM Installer benoetigt Eingabe\n"); $smtp->datasend("MIME-Version: 1.0\n"); $smtp->datasend("Content-type: multipart/mixed; boundary=\"frontier\"/n"); $smtp->datasend("\n--frontier/n"); $smtp->datasend("Content-type: text/plain/n"); $smtp->datasend("Content-Type: application/text; name=\"output.txt\"/n"); # ATTACHMENT funktioniert noch nicht $smtp->datasend("Content-Disposition: attachment; filename=\"output.txt\"/n"); # ATTACHMENT funktioniert noch nicht $smtp->datasend("/n"); #$smtp->datasend("TESTESTTEST/n"); $smtp->dataend(); $smtp->quit; }