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.
This commit is contained in:
1 parent
f859b776a2
commit
b8fe5a19fc
1 file changed
+2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user