initial pfannkuchen
This commit is contained in:
parent
b6dafc7a73
commit
4d305fa19f
99 changed files with 3575 additions and 321 deletions
45
backup.sh
Executable file
45
backup.sh
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# === Konfiguration ===
|
||||
#REPO="root@10.5.85.202:/cluster-backup/$(hostname)"
|
||||
REPO="ssh://storagebox/home/$(hostname)"
|
||||
|
||||
# === Zu sichernde Verzeichnisse ===
|
||||
BACKUP_PATHS="/etc/wireguard/ /app-config"
|
||||
|
||||
# === Archivname mit Datum ===
|
||||
ARCHIVE="$(hostname)-$(date +%Y-%m-%d_%H-%M)"
|
||||
|
||||
# === Logging ===
|
||||
LOGFILE="/var/log/proxmox-borg-backup.log"
|
||||
|
||||
#export BORG_RSH='ssh -i /root/.ssh/id_ed25519'
|
||||
#export BORG_PASSPHRASE='zUGb7Jbc+cMa8RJ'
|
||||
# === Borg Backup ausführen ===
|
||||
echo "[$(date)] Starte Backup: $ARCHIVE" >> $LOGFILE
|
||||
|
||||
borg create \
|
||||
--verbose \
|
||||
--filter AME \
|
||||
--remote-path=borg-1.4 \
|
||||
--stats \
|
||||
--show-rc \
|
||||
--compression lz4 \
|
||||
"$REPO::$ARCHIVE" \
|
||||
$BACKUP_PATHS >> $LOGFILE 2>&1
|
||||
|
||||
BACKUP_RC=$?
|
||||
|
||||
# === Alte Backups aufräumen ===
|
||||
borg prune -v --list "$REPO" \
|
||||
--keep-daily=7 \
|
||||
--keep-weekly=4 \
|
||||
--keep-monthly=6 >> $LOGFILE 2>&1
|
||||
|
||||
PRUNE_RC=$?
|
||||
|
||||
# === Exit-Code prüfen ===
|
||||
GLOBAL_RC=$(( BACKUP_RC > PRUNE_RC ? BACKUP_RC : PRUNE_RC ))
|
||||
|
||||
echo "[$(date)] Backup beendet mit Code $GLOBAL_RC" >> $LOGFILE
|
||||
exit $GLOBAL_RC
|
||||
Loading…
Add table
Add a link
Reference in a new issue