mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 13:20:29 +01:00
allow passing prefix to limit pruning ops
This commit is contained in:
parent
8c7ffc3d99
commit
0069faa7fd
14
README.md
14
README.md
@ -51,11 +51,12 @@ AWS_S3_BUCKET_NAME="<xxx>"
|
|||||||
|
|
||||||
# **IMPORTANT, PLEASE READ THIS BEFORE USING THIS FEATURE**:
|
# **IMPORTANT, PLEASE READ THIS BEFORE USING THIS FEATURE**:
|
||||||
# The mechanism used for pruning backups is not very sophisticated
|
# The mechanism used for pruning backups is not very sophisticated
|
||||||
# and applies its rules to **all files in the target directory**,
|
# and applies its rules to **all files in the target directory** by default,
|
||||||
# which means that if you are storing your backups next to other files,
|
# which means that if you are storing your backups next to other files,
|
||||||
# these might become subject to deletion too. When using this option
|
# these might become subject to deletion too. When using this option
|
||||||
# make sure the backup files are stored in a directory used exclusively
|
# make sure the backup files are stored in a directory used exclusively
|
||||||
# for storing them or you might lose data.
|
# for storing them or to configure BACKUP_PRUNING_PREFIX to limit
|
||||||
|
# removal to certain files.
|
||||||
|
|
||||||
# Define this value to enable automatic pruning of old backups. The value
|
# Define this value to enable automatic pruning of old backups. The value
|
||||||
# declares the number of days for which a backup is kept.
|
# declares the number of days for which a backup is kept.
|
||||||
@ -71,6 +72,15 @@ AWS_S3_BUCKET_NAME="<xxx>"
|
|||||||
|
|
||||||
# BACKUP_PRUNING_LEEWAY="10m"
|
# BACKUP_PRUNING_LEEWAY="10m"
|
||||||
|
|
||||||
|
# In case your target bucket or directory contains other files than the ones
|
||||||
|
# managed by this container, you can limit the scope of rotation by setting
|
||||||
|
# a prefix value. This would usually be the non-parametrized part of your
|
||||||
|
# BACKUP_FILENAME. E.g. if BACKUP_FILENAME is `db-backup-%Y-%m-%dT%H-%M-%S.tar.gz`,
|
||||||
|
# you can set BACKUP_PRUNING_PREFIX to `db-backup-` and make sure
|
||||||
|
# unrelated files are not affected.
|
||||||
|
|
||||||
|
# BACKUP_PRUNING_PREFIX="backup-"
|
||||||
|
|
||||||
########### BACKUP ENCRYPTION
|
########### BACKUP ENCRYPTION
|
||||||
|
|
||||||
# Backups can be encrypted using gpg in case a passphrase is given
|
# Backups can be encrypted using gpg in case a passphrase is given
|
||||||
|
@ -105,6 +105,10 @@ echo "Will wait for next scheduled backup."
|
|||||||
|
|
||||||
prune () {
|
prune () {
|
||||||
target=$1
|
target=$1
|
||||||
|
if [ ! -z "$BACKUP_PRUNING_PREFIX" ]; then
|
||||||
|
target="$target/${BACKUP_PRUNING_PREFIX}"
|
||||||
|
fi
|
||||||
|
|
||||||
rule_applies_to=$(
|
rule_applies_to=$(
|
||||||
mc rm $MC_GLOBAL_OPTIONS --fake --recursive --force \
|
mc rm $MC_GLOBAL_OPTIONS --fake --recursive --force \
|
||||||
--older-than "${BACKUP_RETENTION_DAYS}d" \
|
--older-than "${BACKUP_RETENTION_DAYS}d" \
|
||||||
|
Loading…
Reference in New Issue
Block a user