From b8fe5a19fc908b57cff3c0e66f7be72942958e8f Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 2 Feb 2026 15:28:40 +0000 Subject: [PATCH] Add new condition for when not removing any backups Add a check for when retention equals 0. When retentions is set to 0 but no backups exist the message would still say "No old backups to remove for $vm". This change changes the message as no backups would be removed even if they were found. --- lxc-backup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lxc-backup.sh b/lxc-backup.sh index 8bc7367..f9b8f51 100755 --- a/lxc-backup.sh +++ b/lxc-backup.sh @@ -90,6 +90,8 @@ prune_backups() { if [[ ${#backup_files[@]} -gt 0 ]]; then echo "Removing ${#backup_files[@]} old backup files for $vm (keeping last $retention files)" printf '%s\0' "${backup_files[@]}" | xargs -0 rm -fv > /dev/null + elif [[ "${retention}" -eq 0 ]]; then + echo "Keeping all existing backups for $vm" else echo "No old backups to remove for $vm" fi