mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
parent
40df3e3a37
commit
a9d3926212
@ -340,6 +340,17 @@ then
|
||||
send_error_mail "Could not unmount the LVM snapshot."
|
||||
fi
|
||||
|
||||
# Prune options
|
||||
BORG_PRUNE_OPTS=(--stats --keep-within=7d --keep-weekly=4 --keep-monthly=6 "$BACKUP_TARGET_DIRECTORY")
|
||||
|
||||
# Prune system archives
|
||||
inform_user "$ICyan" "Pruning the system archives..."
|
||||
if ! borg prune --prefix '*_*-NcVM-system-partition' "${BORG_PRUNE_OPTS[@]}"
|
||||
then
|
||||
re_rename_snapshot
|
||||
send_error_mail "Some errors were reported by the prune system command."
|
||||
fi
|
||||
|
||||
# Boot partition backup
|
||||
inform_user "$ICyan" "Creating boot partition backup..."
|
||||
if ! borg create "${BORG_OPTS[@]}" "$BACKUP_TARGET_DIRECTORY::$CURRENT_DATE-NcVM-boot-partition" "/boot/"
|
||||
@ -351,6 +362,14 @@ then
|
||||
send_error_mail "Some errors were reported during the boot partition backup!"
|
||||
fi
|
||||
|
||||
# Prune boot archives
|
||||
inform_user "$ICyan" "Pruning the boot archives..."
|
||||
if ! borg prune --prefix '*_*-NcVM-boot-partition' "${BORG_PRUNE_OPTS[@]}"
|
||||
then
|
||||
re_rename_snapshot
|
||||
send_error_mail "Some errors were reported by the prune boot command."
|
||||
fi
|
||||
|
||||
# Backup additional locations
|
||||
for directory in "${ADDITIONAL_BACKUP_DIRECTORIES[@]}"
|
||||
do
|
||||
@ -382,18 +401,15 @@ do
|
||||
re_rename_snapshot
|
||||
send_error_mail "Some errors were reported during the $DIRECTORY_NAME backup!"
|
||||
fi
|
||||
done
|
||||
|
||||
# Prune the backup repository
|
||||
inform_user "$ICyan" "Pruning the backup..."
|
||||
if ! borg prune --progress --stats "$BACKUP_TARGET_DIRECTORY" \
|
||||
--keep-within=7d \
|
||||
--keep-weekly=4 \
|
||||
--keep-monthly=6
|
||||
then
|
||||
re_rename_snapshot
|
||||
send_error_mail "Some errors were reported by the prune command."
|
||||
fi
|
||||
# Prune archives
|
||||
inform_user "$ICyan" "Pruning the $DIRECTORY_NAME archives..."
|
||||
if ! borg prune --prefix "*_*-NcVM-$DIRECTORY_NAME-directory" "${BORG_PRUNE_OPTS[@]}"
|
||||
then
|
||||
re_rename_snapshot
|
||||
send_error_mail "Some errors were reported by the prune $DIRECTORY_NAME command."
|
||||
fi
|
||||
done
|
||||
|
||||
# Rename the snapshot back to normal
|
||||
if ! re_rename_snapshot
|
||||
|
||||
Loading…
Reference in New Issue
Block a user