diff --git a/NextcloudBackupScript.sh b/NextcloudBackupScript.sh index f85c233..af1d796 100755 --- a/NextcloudBackupScript.sh +++ b/NextcloudBackupScript.sh @@ -9,19 +9,20 @@ SOURCE_DIR="/mnt/data/" REMOTE_USER="backupuser" REMOTE_HOST="alsdorf.spznord.de" REMOTE_PORT="1022" # Neuer Port für die Übertragung -REMOTE_DIR="/mnt/disk0/NextcloudBackup/data/" +REMOTE_DIR="/mnt/disk0/backups/nextcloud/data/" # --- LOGIK --- echo "Starte Synchronisation von $SOURCE_DIR nach $REMOTE_HOST auf Port $REMOTE_PORT..." +# Pfad zum SSH-Key +SSH_KEY="/home/DEIN_USER/.ssh/id_ed25519" -# rsync Optionen: -# -a: Archiv-Modus (behält Rechte, Zeitstempel, etc.) -# -v: Verbose (zeigt an, was passiert) -# -z: Komprimierung während der Übertragung -# -h: Human-readable (bessere Dateigrößenanzeige) -# -e 'ssh -p PORT': Spezifiziert den SSH-Port - -rsync -avzh -e "ssh -p $REMOTE_PORT" "$SOURCE_DIR" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR" +# rsync mit Ausschlussfiltern: +# --exclude 'DATEINAME': Verhindert, dass diese Datei kopiert wird +rsync -avzh \ + -e "ssh -p $REMOTE_PORT -i $SSH_KEY" \ + --exclude 'nextcloud.log' \ + --exclude 'flow.log' \ + "$SOURCE_DIR" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR" # Status prüfen if [ $? -eq 0 ]; then