From: Bastian Dehn Date: Thu, 6 Aug 2026 17:05:48 +0000 (+0200) Subject: add rsync failure error X-Git-Tag: v1.0.6^2~1^2~40 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=6dc559fc0985a8b1f1bb38a8a332bd9a5266a1e0;p=simple-backup.git add rsync failure error --- diff --git a/src/backup b/src/backup index 2528484..fb5a017 100755 --- a/src/backup +++ b/src/backup @@ -176,7 +176,9 @@ path_backup() rsyncargs+=("$hostpath") rsyncargs+=("$full_backup_path") - rsync "${rsyncargs[@]}" + rsync "${rsyncargs[@]}" \ + || errlog "could not backup $machine with path $path" \ + || return $? } machine_backup_pathes() diff --git a/tests/backup_tests.bats b/tests/backup_tests.bats index 023ff9d..aad4125 100755 --- a/tests/backup_tests.bats +++ b/tests/backup_tests.bats @@ -560,4 +560,15 @@ teardown() { assert_equal "$(awk 'NR==9 {print; exit}' "$RSYNC_LOG")" "--rsh=\"ssh -p 22\"" assert_equal "$(awk 'NR==10 {print; exit}' "$RSYNC_LOG")" "/home/local" assert_equal "$(awk 'NR==11 {print; exit}' "$RSYNC_LOG")" "build/2000-01-01_01_backup/onlylocal" +} + +@test "failure backup machine path rsync failed" { + rsync() { + return 1 + } + run main + + assert_failure + assert_line --index 0 "⭐ START: backup" + assert_line --partial "❌ ERROR: could not backup testpc1 with path /etc" } \ No newline at end of file