]> arthur.barton.de Git - backup-script.git/commitdiff
Respect "dry run mode" when continuing snapshots
authorAlexander Barton <alex@barton.de>
Tue, 18 Apr 2017 10:16:31 +0000 (12:16 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 18 Apr 2017 10:16:31 +0000 (12:16 +0200)
And don't rename the snapshot to the new name, no write access!

bin/backup-script

index f2df4db98220e0b12472249e53a883c0ff0db2d0..4ae96d1689c4726fb64ec592415a045ae8e1b031 100755 (executable)
@@ -546,9 +546,13 @@ for f in "${sys[@]}"; do
                if [[ -n "$last" && ! -e "$last/.stamp" ]]; then
                        # Old backup directory without "stamp file", continue
                        echo "Found incomplete snapshot in \"$last\", reusing and renaming it ..."
-                       if ! RenameSubvolume "$last" "$sys_target"; then
-                               echo "Failed to rename last snapshot \"$last\" to \"$sys_target\"!? \"$system\" skipped!"
-                               echo; continue
+                       if [ "$DRYRUN" -eq 0 ]; then
+                               if ! RenameSubvolume "$last" "$sys_target"; then
+                                       echo "Failed to rename last snapshot \"$last\" to \"$sys_target\"!? \"$system\" skipped!"
+                                       echo; continue
+                               fi
+                       else
+                               echo " *** Trial run, not renaming snapshot \"$last\" to \"$sys_target\"!"
                        fi
                elif [ -n "$last" ]; then
                        # Old backup directory found, create new snapshot