From 37b774770d2c4482d658c900a83cb0a87d6b01fd Mon Sep 17 00:00:00 2001 From: Oliver Cervera Date: Thu, 15 Feb 2024 17:00:40 +0100 Subject: [PATCH] Fix error at end of email part 2 Fix error at the end of email with condition "WARNING Forced sync with deleted files" Finally fixes #74 --- snapraid-aio-script.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index 2d51898..88f40e6 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -8,7 +8,7 @@ ###################### # SCRIPT VARIABLES # ###################### -SNAPSCRIPTVERSION="3.3" #DEV8 +SNAPSCRIPTVERSION="3.3" #DEV9 # Read SnapRAID version SNAPRAIDVERSION="$(snapraid -V | sed -e 's/snapraid v\(.*\)by.*/\1/')" @@ -766,8 +766,9 @@ SUMMARY: Equal [$EQ_COUNT] - Added [$ADD_COUNT] - Deleted [$DEL_COUNT] - Moved [ fi if [ "$DEL_COUNT" -ge "$DEL_THRESHOLD" ] && [ "$DO_SYNC" -eq 1 ]; then + if [ "$(echo "$ADD_DEL_THRESHOLD" == 0 | bc -l)" -eq 1 ]; then MSG="Forced sync with deleted files ($DEL_COUNT) / ($DEL_THRESHOLD) violation" - if [ "$(echo "$ADD_DEL_RATIO < $ADD_DEL_THRESHOLD" | bc -l)" -eq 1 ]; then + elif [ "$(echo "$ADD_DEL_RATIO < $ADD_DEL_THRESHOLD" | bc -l)" -eq 1 ]; then MSG="Sync forced with multiple violations - Deleted files ($DEL_COUNT) / ($DEL_THRESHOLD) and add/delete ratio ($ADD_DEL_RATIO) / ($ADD_DEL_THRESHOLD)" fi fi