log/rotate.sh hinzugefügt

This commit is contained in:
alf
2025-07-11 19:10:26 +00:00
parent 6c2ae7637b
commit 7899c24242

21
log/rotate.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Setze Arbeitsverzeichnis
# cd /home/oberkoetter/Dokumente/Git/rettedpv || exit 1
# Pfade definieren
CONFIG="./logrotate.cfg"
STATUS="./logrotate.status"
LOGFILE="./log.txt"
# Prüfe, ob Konfigurationsdatei existiert
if [[ ! -f "$CONFIG" ]]; then
echo "$(date) - Fehler: Konfigurationsdatei '$CONFIG' nicht gefunden." >> "$LOGFILE"
exit 2
fi
# Logrotate ausführen (forcierter Lauf)
logrotate -s "$STATUS" -f "$CONFIG"
# Erfolgs-Log schreiben
echo "$(date) - Logrotate wurde erfolgreich ausgeführt." >> "$LOGFILE"