Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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). #121

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
15 changes: 10 additions & 5 deletions script-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion snapraid-aio-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ 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"
else
# or send a short mail
Expand Down