Update pfsense-backup.sh

This commit is contained in:
2020-08-22 02:31:43 +02:00
committed by GitHub
parent c84a5702b2
commit 0d17d59791
+9 -6
View File
@@ -64,13 +64,16 @@ if [ $cron -eq 1 ]; then
echo "$PFSENSE_CRON_SCHEDULE FROM_CRON=1 /pfsense-backup.sh" | crontab - echo "$PFSENSE_CRON_SCHEDULE FROM_CRON=1 /pfsense-backup.sh" | crontab -
crond -f crond -f
else else
do_backup do_backup
if [ ! -z $keepfiles ]; then if [ ! -z $keepfiles ]; then
remove=$(ls -d -1tr $destination/*.xml | tail -n +$keepfiles | head -n1) remove=$(ls -d -1tr $destination/*.xml | tail -n +$keepfiles | head -n1)
if [ ! -z $remove ]; then if [ ! -z $remove ]; then
rm -f $(ls -d -1tr $destination/*.xml | tail -n -$keepfiles | head -n1) keepfiles=$((keepfiles + 1))
fi del=$(ls $destination/*.xml | tail -n -$keepfiles | head -n1)
rm -f $del
echo "Backup removed at $del"
fi fi
fi
fi fi
else else
do_backup do_backup