1
This commit is contained in:
22
rotate.sh
Normal file
22
rotate.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Setze Arbeitsverzeichnis
|
||||
cd /home/oberkoetter/Dokumente/Git/rettedpv || exit 1
|
||||
|
||||
# Pfade definieren
|
||||
CONFIG="./logrotate.cfg"
|
||||
STATUS="./logrotate.status"
|
||||
LOGFILE="./logrotate.log"
|
||||
|
||||
# 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"
|
||||
|
||||
Reference in New Issue
Block a user