Fix prune options
This commit is contained in:
parent
3d381297f2
commit
5886973eed
@ -17,6 +17,9 @@ export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
|
|||||||
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
||||||
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO
|
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO
|
||||||
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO
|
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO
|
||||||
|
# Set to empty string to disable pruning.
|
||||||
|
PRUNE_OPTIONS="--keep-daily 7 --keep-weekly 4 --keep-monthly 6"
|
||||||
|
|
||||||
|
|
||||||
for IMAGE in $IMAGES; do
|
for IMAGE in $IMAGES; do
|
||||||
# Export volume to borg backup.
|
# Export volume to borg backup.
|
||||||
@ -32,18 +35,18 @@ for IMAGE in $IMAGES; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If you want to prune backups, you can set the prune options.
|
# Prune if options are configured.
|
||||||
echo "Pruning backups for $IMAGE"
|
if [ -n "$PRUNE_OPTIONS" ]; then
|
||||||
borg prune --list \
|
echo "Pruning backups for $IMAGE"
|
||||||
--show-rc \
|
borg prune --list \
|
||||||
--glob-archives "$IMAGE-*" \
|
--show-rc \
|
||||||
--keep-daily 7 \
|
--glob-archives "$IMAGE-*" \
|
||||||
--keep-weekly 4 \
|
$PRUNE_OPTIONS
|
||||||
--keep-monthly 6
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed prune $IMAGE"
|
echo "Failed to prune $DOMAIN"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user