Skip to content

Commit

Permalink
Merge pull request prodrigestivill#72 from PedroCapdevila/patch-1
Browse files Browse the repository at this point in the history
Fix delete old backups in folder last
  • Loading branch information
prodrigestivill authored Apr 5, 2022
2 parents f0b5949 + 130e5a3 commit af916da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ for DB in ${POSTGRES_DBS}; do
ln -svf "${MONTHY_FILENAME}" "${BACKUP_DIR}/monthly/${DB}-latest${BACKUP_SUFFIX}"
#Clean old files
echo "Cleaning older files for ${DB} database from ${POSTGRES_HOST}..."
find "${BACKUP_DIR}/last" -maxdepth 1 -mmin "${KEEP_MINS}" -name "${DB}-*${BACKUP_SUFFIX}" -exec rm -rf '{}' ';'
find "${BACKUP_DIR}/last" -maxdepth 1 -mmin "+${KEEP_MINS}" -name "${DB}-*${BACKUP_SUFFIX}" -exec rm -rf '{}' ';'
find "${BACKUP_DIR}/daily" -maxdepth 1 -mtime "+${KEEP_DAYS}" -name "${DB}-*${BACKUP_SUFFIX}" -exec rm -rf '{}' ';'
find "${BACKUP_DIR}/weekly" -maxdepth 1 -mtime "+${KEEP_WEEKS}" -name "${DB}-*${BACKUP_SUFFIX}" -exec rm -rf '{}' ';'
find "${BACKUP_DIR}/monthly" -maxdepth 1 -mtime "+${KEEP_MONTHS}" -name "${DB}-*${BACKUP_SUFFIX}" -exec rm -rf '{}' ';'
Expand Down

0 comments on commit af916da

Please sign in to comment.