
The backup verifier currently emails us warnings about inconsistent backups in purged backup locations. This is expected because the backups have been removed/purged. Update the verifier to simply log and skip over these cases. Change-Id: I0dd0b464e64dd4795d75e71ec4218d851eb9f742
35 lines
1.0 KiB
Bash
35 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
# When under cron, SHELL can bin /bin/sh which the "sudo -s" below
|
|
# obeys. Let's just use bash.
|
|
export SHELL=/bin/bash
|
|
|
|
pushd /opt/backups
|
|
|
|
for u in borg-*; do
|
|
BORG_BASE=/opt/backups/$u
|
|
BORG_REPO=${BORG_BASE}/backup
|
|
BORG_RETIRED=${BORG_BASE}/.retired
|
|
|
|
if [[ -f "${BORG_RETIRED}" ]] && [[ ! -d "${BORG_REPO}" ]]; then
|
|
# This repo was retired and purged. We don't need to verify it.
|
|
echo "$(date) Skipping ${BORG_REPO} it is retired and purged."
|
|
continue
|
|
fi
|
|
|
|
sudo BORG_RELOCATED_REPO_ACCESS_IS_OK=y BORG_REPO=${BORG_REPO} -u ${u} -s <<'EOF'
|
|
|
|
echo "$(date) Verifying ${BORG_REPO} ..."
|
|
/opt/borg/bin/borg check --lock-wait=3600 --verify-data
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "$(date) *** Verification failed"
|
|
echo "Inconsistency found in backup ${BORG_REPO} on $(hostname) at $(date)" |
|
|
mail -s "ACTION REQUIRED: Backup inconsistency: ${BORG_REPO}" infra-root@openstack.org
|
|
else
|
|
echo "$(date) ... done"
|
|
echo
|
|
fi
|
|
|
|
EOF
|
|
done
|