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:
@@ -587,7 +587,11 @@ class Backup:
|
|||||||
logger.error(output)
|
logger.error(output)
|
||||||
|
|
||||||
if self.keep != -1 and not self._remove_before:
|
if self.keep != -1 and not self._remove_before:
|
||||||
self.remove_old_backups()
|
# 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._inputs_path)
|
||||||
os.remove(self._exclude_path)
|
os.remove(self._exclude_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user