Update pibackup.sh

This commit is contained in:
2022-11-05 13:23:51 -05:00
parent 4325059af9
commit e4d038cdf3

View File

@@ -56,7 +56,12 @@ if [ "$1" != "update" ]; then
echo "$(date) - Removing old backups..."
allfiles=`ls -1 ${BackupDir}/*.img.gz`
files=(`ls -1 ${BackupDir}/*.img.gz | tail -3`)
if [ "${BackupsToKeep}" == "" ]; then
BackupsToKeep=3
fi
files=(`ls -1 ${BackupDir}/*.img.gz | tail -${BackupsToKeep}`)
for i in $allfiles; do keep=0;
for a in ${files[@]}; do
if [ $i == $a ]; then keep=1; fi;