fetchmailnochda.pl [plain text]
use File::Compare;
$fetchmail = '/usr/bin/fetchmail';
$fetchmaillog = '/var/log/fetchmail.log';
$fetchmailwatch = '/var/log/fetchmailwatch';
$fetchmailtime = '3600';
$fetchmailconf = '/root/.fetchmailrc';
$copycp = 'cp';
if (!(-e "$fetchmaillog")) {
print "There seems to be a problem with the fetchmail daemon\n
I couldn't find a logfile of fetchmail.\n
I try to stop and to start fetchmail in daemon mode.\n
If you get this mail more then once, then check your system !\n
------------------------------------------------------------\n
Es ist ein Fehler aufgetreten bei der Ueberwachung des fetchmail Daemons\n
Es existiert keine Logdatei. Ich versuche jetzt fetchmail zu stoppen und neu zu \n
starten. Sollte das Problem nochmal auftreten, dann genaue Systeminspektion !\n
------------------------------------------------------------\n
Das fetchmail Ueberwachungsscript Copyright 2001 by T. Mueller torsten\@archesoft.de\n\n";
system "$fetchmail -q";
sleep 3 ;
system "$fetchmail -f $fetchmailconf -d $fetchmailtime -L $fetchmaillog";
sleep 2 ;
}
if (!(-e "$fetchmailwatch")) {
print "There seems to be a problem with the fetchmail daemon\n
I couldn't find the copy of the original logfile of fetchmail.\n
If this is this the first run of this script, then this is no problem!\n
If you get this mail more then once, then check your system !\n
------------------------------------------------------------\n
Es ist ein Fehler aufgetreten bei der Ueberwachung des fetchmail Daemons\n
Es existiert keine Kopie der Logdatei. Wenn das Script das erste Mal aufgerufen wurde,\n
dann ist dies kein Problem. Sollte dieses Problem nochmal auftreten, dann genaue Systeminspektion !\n
------------------------------------------------------------\n
Das fetchmail Ueberwachungsscript Copyright 2001 by T. Mueller torsten\@archesoft.de\n\n";
©log;
exit; }
$vergleich = compare("$fetchmaillog","$fetchmailwatch");
if ($vergleich == -1) {
print "There seems to be a problem with the fetchmail daemon or this script\n
I don't know, why this error happens.
Please check the script and your system
------------------------------------------------------------\n
Es ist ein Fehler aufgetreten bei der Ueberwachung des fetchmail Daemons\n
Bitte die notwendigen Schritte unternehmen, z.B. Festplattenspeicherplatz pruefen\n
noch eine kommt.\n
------------------------------------------------------------\n
Das fetchmail Ueberwachungsscript Copyright 2001 by T. Mueller torsten\@archesoft.de\n\n";
}
if ($vergleich == 0) {
print "There seems to be a problem with the fetchmail daemon\n
The logfile seems the be the same as the last logfile i have seen.
That could mean, that fetchmail hangs, or permissionproblems or disk full.
I try to stop and to start fetchmail in daemon mode.\n
If you get this mail more then once, then check your system !\n
------------------------------------------------------------\n
Scheinbar gab es ein Problem mit dem Programm fetchmail\n
Die Logdatei war identisch mit der Logdatei beim letzten Lauf diese Scriptes\n
Daraus schlussfolgere ich, dass nichts mehr geloggt wurde -> fetchmail hat ein Problem\n
Ich habe fetchmail versucht zu stoppen, und wieder neu zu starten.\n
Sollte diese Mail heute noch mehrfach erscheinen, dann ist eine genauere Inspektion\n
der Umstaende notwendig. Ist dies die erste Mail, dann einfach mal abwarten, ob\n
noch eine kommt.\n
------------------------------------------------------------\n
Das fetchmail Ueberwachungsscript Copyright 2001 by T. Mueller torsten\@archesoft.de\n\n";
system "$fetchmail -q";
sleep 3 ;
system "$fetchmail -f $fetchmailconf -d $fetchmailtime -L $fetchmaillog";
sleep 2 ;
}
©log;
sub copylog {
system "$copycp $fetchmaillog $fetchmailwatch";
}