From 3113e182c788856f274e6cc0640188dd7b78cd95 Mon Sep 17 00:00:00 2001 From: Fuxino Date: Thu, 8 Oct 2026 20:12:29 +0200 Subject: [PATCH] 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. --- man/simple_backup.1 | 5 +++-- simple_backup/simple_backup.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/man/simple_backup.1 b/man/simple_backup.1 index 0cb584b..b86e4ba 100644 --- a/man/simple_backup.1 +++ b/man/simple_backup.1 @@ -180,7 +180,8 @@ for details. For this reason, use SSH key authentication if possible. .SH EXIT STATUS .TP .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 .B 1 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. .TP .B 4 -rsync error (rsync returned a non-zero value). +rsync error (rsync returned a value other than 0 or 24). .TP .B 5 SSH connection failed. diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index 27cb4ca..18f8893 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -472,7 +472,7 @@ class Backup: 'Rsync error (return code 23) - Partial transfer due to error') case 24: 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: logger.error( 'Rsync error (return code 30) - Timeout in data send/receive') @@ -617,7 +617,8 @@ class Backup: 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( 'Some errors occurred while performing the backup')