first commit
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variablen
|
||||
REPO="ssh://stefan@172.25.28.34:22/srv/usbplatte/nauheim1vps"
|
||||
SOURCE="/home/stefan"
|
||||
EXCLUDES=(
|
||||
"/home/stefan/docker/privatebin"
|
||||
"/home/stefan/docker/psitransfer"
|
||||
"/home/stefan/docker/tautulli/config/cache/images"
|
||||
"/home/stefan/docker/resiliosync/sync"
|
||||
"/home/stefan/docker/resiliosync/cache"
|
||||
"/home/stefan/docker/komga/database.sqlite"
|
||||
"/home/stefan/docker/komga/logs"
|
||||
"/home/stefan/docker/komga/lucene"
|
||||
"/home/stefan/syncthing/sync"
|
||||
)
|
||||
|
||||
BACKUP_NAME="backup-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
GOTIFY_URL="https://gotify.nauheimtech.de"
|
||||
GOTIFY_TOKEN=${GOTIFY_PW}
|
||||
|
||||
# Backup starten
|
||||
echo "===== Backup gestartet: $(date) ====="
|
||||
borg create --stats --progress "$REPO::$BACKUP_NAME" "$SOURCE" \
|
||||
$(printf -- '--exclude=%s ' "${EXCLUDES[@]}")
|
||||
BACKUP_EXIT=$?
|
||||
|
||||
# Falls das Backup fehlschlägt, Nachricht an Gotify senden
|
||||
if [ $BACKUP_EXIT -ne 0 ]; then
|
||||
MESSAGE="Backup fehlgeschlagen: $BACKUP_NAME"
|
||||
PRIORITY=10
|
||||
echo "FEHLER: Backup fehlgeschlagen ($BACKUP_NAME) am $(date)"
|
||||
curl -s -X POST "$GOTIFY_URL/message" \
|
||||
-H "X-Gotify-Key: $GOTIFY_TOKEN" \
|
||||
-d "title=Backup Fehler&message=$MESSAGE&priority=$PRIORITY"
|
||||
fi
|
||||
|
||||
# Alte Backups bereinigen
|
||||
echo "===== Alte Backups bereinigen: $(date) ====="
|
||||
borg prune --keep-hourly=12 --keep-daily=7 --keep-weekly=4 --keep-monthly=6 "$REPO"
|
||||
|
||||
echo "===== Backup abgeschlossen: $(date) ====="
|
||||
Reference in New Issue
Block a user