Don't remove old backups if rsync fails

If rsync returns an error, the new backup may be incomplete. Keep
the old backups in that case, except for return code 24 (vanished
source files), which is expected when backing up a live system.
This commit is contained in:
Fuxino
2026-10-08 17:38:34 +02:00
parent 2c2649113d
commit 2b91178e94
+4
View File
@@ -587,7 +587,11 @@ class Backup:
logger.error(output)
if self.keep != -1 and not self._remove_before:
# Don't delete old backups if the new one may be incomplete
if returncode in [0, 24]:
self.remove_old_backups()
else:
logger.warning('Backup not completed successfully. Old backups will not be removed')
os.remove(self._inputs_path)
os.remove(self._exclude_path)