Backup cleanup

This commit is contained in:
Michael Stanclift
2020-07-10 22:19:28 -05:00
parent bc08ed3fa6
commit 693ca75715
2 changed files with 7 additions and 1 deletions

View File

@ -170,7 +170,7 @@ The `./gravity-sync.sh config` function will attempt to ping the remote host to
Default setting in Gravity Sync is 0, change to 1 to skip this network test.
#### `BACKUP_RETAIN=''`
The `./gravity-sync.sh backup` function will retain a defined number of previous `gravity.db` and `custom.list` backups.
The `./gravity-sync.sh backup` function will retain a defined number of days worth of `gravity.db` and `custom.list` backups.
Default setting in Gravity Sync is 7, adjust as resired.

View File

@ -1627,6 +1627,12 @@ function task_backup {
cp ${PIHOLE_DIR}/${CUSTOM_DNS} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${CUSTOM_DNS}.backup
error_validate
MESSAGE="Cleaning Up Old Backups"
echo_stat
find $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/$(date +%Y)*.backup -mtime +${BACKUP_RETAIN} -type f -delete
error_validate
exit_withchange
}