Logwatch Skript
Verfasst: 03.11.2014 15:03:35
Hi,
ich moechte mit einem Skript Logwatch alle paar Tage starten und mir den Log per Mail zuschicken. Dazu habe ich folgendes Skript:
logwatch.sh
Das klappt auch, also ./logwatch.sh und ich bekomme ne Mail mit der log-Datei im Anhang.
Nun ja, jetzt habe ich das ganze in einen crontab hinzugefuegt:
crontab -e
Ich bekomme zwar alle Tage eine Mail mit Anhang, doch der Anhang ist leer (0byte). Wie gesagt, starte ich das Skript von Hand klappt es, automatisiert nicht.
Hat jemand eine Idee?
Gruss,
who
ich moechte mit einem Skript Logwatch alle paar Tage starten und mir den Log per Mail zuschicken. Dazu habe ich folgendes Skript:
logwatch.sh
Code: Alles auswählen
#!/bin/sh
rm /root/logwatch/logwatch.txt
logwatch --detail low --range today > /root/logwatch/logwatch.txt
DATE=$(date)
sendemail -f "X-X-X-X" -t "X-X-X-X" -u "Daily logwatch" -m "Log from "$DATE"" -a "/root/logwatch/logwatch.txt" -s "X-X-X-X" -o tls=no -xu "X-X-X-X" -xp "X-X-X-X"
Nun ja, jetzt habe ich das ganze in einen crontab hinzugefuegt:
crontab -e
Code: Alles auswählen
0 0 * * 0 /root/logwatch/logwatch.sh
0 0 * * 3 /root/logwatch/logwatch.sh
0 0 * * 5 /root/logwatch/logwatch.sh
Hat jemand eine Idee?
Gruss,
who