From 672accc6a1a8ef26e574f44436446278ead8f7bc Mon Sep 17 00:00:00 2001 From: Waters Church Date: Thu, 8 Oct 2026 09:39:31 -0400 Subject: [PATCH] Add --dry-run to the weekly health check Lets the email be read before it is sent, which matters for a message whose whole job is to be clear at a glance a week from now. Co-Authored-By: Claude Opus 5 --- scripts/weekly-health.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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"