]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
fix rsync args all in loop
authorBastian Dehn <hhaalo@arcor.de>
Sun, 28 Jun 2026 08:50:56 +0000 (10:50 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 28 Jun 2026 08:51:01 +0000 (10:51 +0200)
src/backup

index c4767b2008a13f366718dfb06a5559bcae325f0b..65b5b2f89832493fc1ac461ee4b482ab3919c43f 100755 (executable)
@@ -116,13 +116,7 @@ backup_remote_pathes()
        local YELLOW="\e[0;33m"
        local LIGHTPURPLE="\e[1;35m"
        local RESET="\e[0m"
-       local rsyncargs=("--archive" \
-               "--verbose" \
-               "--sparse"
-               "--acls" \
-               "--hard-links" \
-               "--relative" \
-               "--human-readable")
+       local rsyncargs=()
 
        remote_user=$(yq \
                --raw-output ".machines.\"$machine\".remote_user" config.yaml)
@@ -145,13 +139,6 @@ backup_remote_pathes()
                config.yaml \
                2> /dev/null)
 
-       if [ "$excludes" != "null" ]; then
-               local exclude=
-               for exclude in $excludes; do
-                       rsyncargs+=("--exclude=$exclude")
-               done
-       fi
-       rsyncargs+=("--rsh=ssh -p $port")
 
        local path=
        for path in $pathes; do
@@ -159,6 +146,22 @@ backup_remote_pathes()
                printf "ℹ️  INFO: machine ${LIGHTPURPLE}%s${RESET}; " "$machine"
                printf "path ${YELLOW}%s${RESET}\n\n" "$path"
 
+               rsyncargs=("--archive"
+                       "--verbose"
+                       "--sparse"
+                       "--acls"
+                       "--hard-links"
+                       "--relative"
+                       "--human-readable")
+
+               if [ "$excludes" != "null" ]; then
+                       local exclude=
+                       for exclude in $excludes; do
+                               rsyncargs+=("--exclude=$exclude")
+                       done
+               fi
+               rsyncargs+=("--rsh=ssh -p $port")
+
                [ -n "$last_backup_dir_path" ] \
                        && rsyncargs+=("--link-dest=$last_backup_dir_path/$machine")