Treat rsync return code 24 as success

Code 24 (source files vanished during the transfer) already counted as
success when deciding whether to remove old backups, but the program
still exited with 4 and reported errors. Exit with 0 and report the
backup as completed, logging only a warning, so both checks agree.
This commit is contained in:
Fuxino
2026-10-08 20:12:29 +02:00
parent 8fc3c42a5e
commit 3113e182c7
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -180,7 +180,8 @@ for details. For this reason, use SSH key authentication if possible.
.SH EXIT STATUS .SH EXIT STATUS
.TP .TP
.B 0 .B 0
The backup was completed without errors. The backup was completed without errors. This includes rsync return code 24 (some source files
vanished during the transfer), which only logs a warning.
.TP .TP
.B 1 .B 1
No valid inputs selected for backup. No valid inputs selected for backup.
@@ -192,7 +193,7 @@ Backup failed because output directory for storing the backup does not exist.
Permission denied to access the output directory. Permission denied to access the output directory.
.TP .TP
.B 4 .B 4
rsync error (rsync returned a non-zero value). rsync error (rsync returned a value other than 0 or 24).
.TP .TP
.B 5 .B 5
SSH connection failed. SSH connection failed.
+3 -2
View File
@@ -472,7 +472,7 @@ class Backup:
'Rsync error (return code 23) - Partial transfer due to error') 'Rsync error (return code 23) - Partial transfer due to error')
case 24: case 24:
logger.warning( logger.warning(
'Rsync error (return code 24) - Partial transfer due to vanished source files') 'Rsync warning (return code 24) - Some source files vanished during the transfer')
case 30: case 30:
logger.error( logger.error(
'Rsync error (return code 30) - Timeout in data send/receive') 'Rsync error (return code 30) - Timeout in data send/receive')
@@ -617,7 +617,8 @@ class Backup:
self._ssh.close() self._ssh.close()
if returncode != 0: # Files vanishing during the transfer is normal for a live system (return code 24)
if returncode not in [0, 24]:
logger.error( logger.error(
'Some errors occurred while performing the backup') 'Some errors occurred while performing the backup')