From 2db7e0ae4643a08d6673dffd5e4bb61348b80130 Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:46:21 +0200 Subject: [PATCH 1/9] Add new verbosity option (send verbose mail after no sync because of failed checks) Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0). --- snapraid-aio-script.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index 28601fd..b7af3cb 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -361,6 +361,10 @@ fi # send long mail if verbosity is set to 1 if [ "$VERBOSITY" -eq 1 ]; then send_mail < "$TMP_OUTPUT" + # send a long mail if the sync did not run due to failed checks (deleted or updated files threshold reached or exceeded) + # and verbosity is set to 2 + elif [ "$VERBOSITY" -eq 2 ] && [ "$CHK_FAIL" -eq 1 ] && [ "$DO_SYNC" -eq 0 ]; then + send_mail < "$TMP_OUTPUT" else # or send a short mail trim_log < "$TMP_OUTPUT" | send_mail From 9312e9aaa456cf17a88a7adbaba3175151aa4a23 Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:48:04 +0200 Subject: [PATCH 2/9] Add new verbosity option (send verbose mail after no sync because of failed checks) Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0). From c7fa2638eb807d25b63848b8dfe49617671397ff Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:48:22 +0200 Subject: [PATCH 3/9] Add new verbosity option (send verbose mail after no sync because of failed checks) Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0). From 88d19ef67bdbeba8afe5ec2b3beefd3478b08454 Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:17:23 +0200 Subject: [PATCH 4/9] Add new verbosity option (send verbose mail after no sync because of failed checks) Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0). --- snapraid-aio-script.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index b7af3cb..7ff6a37 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -359,12 +359,12 @@ fi # Add a topline to email body and send a long mail sed_me "1s:^:##$SUBJECT \n:" "${TMP_OUTPUT}" # send long mail if verbosity is set to 1 - if [ "$VERBOSITY" -eq 1 ]; then + if [ "$VERBOSITY" -eq 1 ]; then + send_mail < "$TMP_OUTPUT" + # send a long mail if the sync did not run due to failed checks (deleted or updated files threshold reached or exceeded) + # and verbosity is set to 2 + elif [ "$VERBOSITY" -eq 2 ] && [ "$CHK_FAIL" -eq 1 ] && [ "$DO_SYNC" -eq 0 ]; then send_mail < "$TMP_OUTPUT" - # send a long mail if the sync did not run due to failed checks (deleted or updated files threshold reached or exceeded) - # and verbosity is set to 2 - elif [ "$VERBOSITY" -eq 2 ] && [ "$CHK_FAIL" -eq 1 ] && [ "$DO_SYNC" -eq 0 ]; then - send_mail < "$TMP_OUTPUT" else # or send a short mail trim_log < "$TMP_OUTPUT" | send_mail From ef97d2b428024125f4a9a7416bfb0dd0322366f3 Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:35:02 +0200 Subject: [PATCH 5/9] Add new verbosity option (send verbose mail after no sync because of failed checks) Add verbosity option 2: Include TOUCH and DIFF output in email (only) if no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded). --- script-config.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/script-config.sh b/script-config.sh index 9dbf019..323ed7f 100644 --- a/script-config.sh +++ b/script-config.sh @@ -132,11 +132,16 @@ FORCE_ZERO=0 # hd-idle is required and must be already configured. SPINDOWN=0 -# Increase verbosity of the email output. NOT RECOMMENDED! -# If set to 1, TOUCH and DIFF outputs will be kept in the email, producing -# a mostly unreadable email. You can always check TOUCH and DIFF outputs -# using the TMP file or use the feature RETENTION_DAYS. -# 1 to enable, any other value to disable. +# Increase verbosity of the email output. +# If set to 2, TOUCH and DIFF outputs will be kept in the email, when the +# threshold for deleted or updated files has been reached or exceeded and +# no sync was run because of that. In all other cases there will be a shorter, +# more readable email. +# NOT RECOMMENDED: If set to 1, TOUCH and DIFF outputs will always be kept +# in the email, producing a mostly unreadable email. +# You can always check TOUCH and DIFF outputs using the TMP file or use the feature +# RETENTION_DAYS. +# Set to any other value than 1 or 2 to disable increased verbosity completely (default) VERBOSITY=0 # SnapRAID detailed output retention for each run. From e7b40092b3a20a33ca47963b76b56f88834bfcca Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:33:34 +0200 Subject: [PATCH 6/9] Set character set for email to UTF-8 Some characters in the email might not be displayed correctly. Setting the charset of the email to utf-8 solves this. --- snapraid-aio-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index 7ff6a37..40821b7 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -963,7 +963,7 @@ elif [ "$EMAIL_ADDRESS" ]; then echo "$body" ) | sendmail -t else - $MAIL_BIN -a 'Content-Type: text/html' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ + $MAIL_BIN -a 'Content-Type: text/html charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ < <(echo "$body") fi fi From 618daf50c88380a62eab8448efea00a09007becf Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Fri, 16 Aug 2024 13:38:29 +0200 Subject: [PATCH 7/9] Set character set for email to UTF-8 Some characters in the email might not be displayed correctly. Setting the charset of the email to utf-8 solves this. --- snapraid-aio-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index 40821b7..09c9dc2 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -963,7 +963,7 @@ elif [ "$EMAIL_ADDRESS" ]; then echo "$body" ) | sendmail -t else - $MAIL_BIN -a 'Content-Type: text/html charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ + $MAIL_BIN -a 'Content-Type: text/html; charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ < <(echo "$body") fi fi From 3c5263aa447b38beeddc8b5255054749d017ce13 Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:07:45 +0200 Subject: [PATCH 8/9] Revert " Set character set for email to UTF-8 " This reverts commit 618daf50c88380a62eab8448efea00a09007becf. --- snapraid-aio-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index 09c9dc2..40821b7 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -963,7 +963,7 @@ elif [ "$EMAIL_ADDRESS" ]; then echo "$body" ) | sendmail -t else - $MAIL_BIN -a 'Content-Type: text/html; charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ + $MAIL_BIN -a 'Content-Type: text/html charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ < <(echo "$body") fi fi From 9b566521f27784b7f7b339622d365d93ba6a27b5 Mon Sep 17 00:00:00 2001 From: DonkeeeyKong <135337455+DonkeeeyKong@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:09:44 +0200 Subject: [PATCH 9/9] Revert "Set character set for email to UTF-8" This reverts commit e7b40092b3a20a33ca47963b76b56f88834bfcca. --- snapraid-aio-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapraid-aio-script.sh b/snapraid-aio-script.sh index 40821b7..7ff6a37 100644 --- a/snapraid-aio-script.sh +++ b/snapraid-aio-script.sh @@ -963,7 +963,7 @@ elif [ "$EMAIL_ADDRESS" ]; then echo "$body" ) | sendmail -t else - $MAIL_BIN -a 'Content-Type: text/html charset=UTF-8' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ + $MAIL_BIN -a 'Content-Type: text/html' -s "$SUBJECT" -r "$FROM_EMAIL_ADDRESS" "$EMAIL_ADDRESS" \ < <(echo "$body") fi fi