]> arthur.barton.de Git - backup-script.git/commitdiff
Use correct counter when checking which generations to delete
authorAlexander Barton <alex@barton.de>
Wed, 29 Jul 2015 08:28:44 +0000 (10:28 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 29 Jul 2015 08:28:44 +0000 (10:28 +0200)
In a18f7fb9 we fixed the counter, but up to now didn't use the
correct counter at all :-/

bin/backup-script

index 79b171d508a76a6b347cabf09f0c6121c6520644..478e505f9795f9bff02d47990abb8f522bca2449 100755 (executable)
@@ -452,8 +452,8 @@ for f in $sys; do
                        ln -s "$sys_target" "$sys_root/latest"
                fi
                # Clean up old generations
-               to_delete=$(ls -1t "$sys_root" 2>/dev/null | tail -n+$generations | sort)
                declare -i gen_count=$generations+2
+               to_delete=$(ls -1t "$sys_root" 2>/dev/null | tail -n+$gen_count | sort)
                if [ -n "$to_delete" -a $ok -eq 1 ]; then
                        [ "$DRYRUN" -eq 0 ] \
                                && echo "Deleting old backup generations (keep $generations) ..." \