]> arthur.barton.de Git - backup-script.git/commitdiff
Correctly count the number of available generations
authorAlexander Barton <alex@barton.de>
Mon, 27 Jul 2015 16:49:56 +0000 (18:49 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 28 Jul 2015 14:07:29 +0000 (16:07 +0200)
Add 2 to the number of desired snapshots, because of the "latest" link
and the current snapshot.

bin/backup-script

index 85b62a8d8c8085ce4886167c362a1ae13f7f894e..1625b723a83fa31e619d2a3fe87c5ed69a26c826 100755 (executable)
@@ -446,9 +446,10 @@ for f in $sys; do
                fi
                # Clean up old generations
                to_delete=$(ls -1t "$sys_root" 2>/dev/null | tail -n+$generations | sort)
+               declare -i gen_count=$generations+2
                if [ -n "$to_delete" -a $ok -eq 1 ]; then
                        [ "$DRYRUN" -eq 0 ] \
-                               && echo "Deleting old backup generations:" \
+                               && echo "Deleting old backup generations (keep $generations) ..." \
                                || echo " *** Trial run, not deleting old generations:"
                        for delete in $to_delete; do
                                dir="$sys_root/$delete"