mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-10 00:30:29 +01:00
sleep 10 minutes before pruning backups
if pruning happens immediatley after taking the backup a race condition can occur where a backup that would theoretically be eligible won't be pruned as the current backup run was very fast, putting the potential candidate just at the very edge of the selected time window
This commit is contained in:
parent
204a0862c6
commit
2892369677
@ -72,6 +72,7 @@ echo "Will wait for next scheduled backup."
|
|||||||
|
|
||||||
if [ ! -z "$BACKUP_RETENTION_DAYS" ]; then
|
if [ ! -z "$BACKUP_RETENTION_DAYS" ]; then
|
||||||
info "Pruning old backups"
|
info "Pruning old backups"
|
||||||
|
echo "Sleeping ${BACKUP_PRUNING_LEEWAY} before checking eligibility."
|
||||||
bucket=$AWS_S3_BUCKET_NAME
|
bucket=$AWS_S3_BUCKET_NAME
|
||||||
|
|
||||||
rule_applies_to=$(mc rm --fake --recursive -force --older-than "${BACKUP_RETENTION_DAYS}d" "backup-target/$bucket" | wc -l)
|
rule_applies_to=$(mc rm --fake --recursive -force --older-than "${BACKUP_RETENTION_DAYS}d" "backup-target/$bucket" | wc -l)
|
||||||
|
@ -15,6 +15,7 @@ BACKUP_CRON_EXPRESSION="${BACKUP_CRON_EXPRESSION:-@daily}"
|
|||||||
BACKUP_FILENAME=${BACKUP_FILENAME:-"backup-%Y-%m-%dT%H-%M-%S.tar.gz"}
|
BACKUP_FILENAME=${BACKUP_FILENAME:-"backup-%Y-%m-%dT%H-%M-%S.tar.gz"}
|
||||||
|
|
||||||
BACKUP_RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-}"
|
BACKUP_RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-}"
|
||||||
|
BACKUP_PRUNING_LEEWAY="${BACKUP_PRUNING_LEEWAY:-10m}"
|
||||||
|
|
||||||
AWS_S3_BUCKET_NAME="${AWS_S3_BUCKET_NAME:-}"
|
AWS_S3_BUCKET_NAME="${AWS_S3_BUCKET_NAME:-}"
|
||||||
AWS_ENDPOINT="${AWS_ENDPOINT:-s3.amazonaws.com}"
|
AWS_ENDPOINT="${AWS_ENDPOINT:-s3.amazonaws.com}"
|
||||||
|
Loading…
Reference in New Issue
Block a user