Merge "Skip purged borg backups during backup pruning"

This commit is contained in:
Zuul 2024-11-25 18:44:02 +00:00 committed by Gerrit Code Review
commit 52f864727e

View File

@ -26,10 +26,15 @@ pushd /opt/backups
for u in borg-*; do
BORG_BASE=/opt/backups/$u
BORG_REPO=${BORG_BASE}/backup
BORG_RETIRED=${BORG_BASE}/.retired
_prune_flags='--keep-daily 7 --keep-weekly 4 --keep-monthly 12'
_retired=''
if [[ -f ${BORG_BASE}/.retired ]]; then
if [[ -f "${BORG_RETIRED}" ]] && [[ ! -d "${BORG_REPO}" ]]; then
# This repo was retired and purged. We don't need to prune it.
echo "$(date) Skipping ${BORG_REPO} it is retired and purged."
continue
elif [[ -f "${BORG_RETIRED}" ]]; then
_prune_flags='--keep-daily 1'
_retired=' (retired)'
fi