diff --git a/scripts/weekly-health.sh b/scripts/weekly-health.sh index 7011117..d2d055c 100755 --- a/scripts/weekly-health.sh +++ b/scripts/weekly-health.sh @@ -15,6 +15,11 @@ set -uo pipefail +# --dry-run prints the email instead of sending it. Useful for reading what it will say +# before a week goes by, and for checking the wording without filling an inbox. +DRY=0 +[ "${1:-}" = "--dry-run" ] && DRY=1 + ROOT="$(cd "$(dirname "$0")/.." && pwd)" NAS_HOST="10.1.1.5" NAS_USER="Christian" @@ -122,5 +127,10 @@ $LINES MSG fi -node "$ROOT/scripts/alert.js" "$SUBJECT" "$(cat "$BODY_FILE")" +if [ "$DRY" = 1 ]; then + printf 'Subject: %s\n\n' "$SUBJECT" + cat "$BODY_FILE" +else + node "$ROOT/scripts/alert.js" "$SUBJECT" "$(cat "$BODY_FILE")" +fi rm -f "$BODY_FILE"