← back to Launchd Reminders
Fix reminder scripts: capture curl exit code correctly, not the assignment's
b0d427358d30a01e99ef57d81d232e12d5c73ef2 · 2026-05-18 20:19:23 -0700 · Steve Abrams
Files touched
M twitter-token-reminder.shM wolf-gordon-reauth-reminder.sh
Diff
commit b0d427358d30a01e99ef57d81d232e12d5c73ef2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon May 18 20:19:23 2026 -0700
Fix reminder scripts: capture curl exit code correctly, not the assignment's
---
twitter-token-reminder.sh | 14 +++++++++-----
wolf-gordon-reauth-reminder.sh | 14 +++++++++-----
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/twitter-token-reminder.sh b/twitter-token-reminder.sh
index 2318970..0717738 100755
--- a/twitter-token-reminder.sh
+++ b/twitter-token-reminder.sh
@@ -8,6 +8,7 @@ LABEL="com.steve.twitter-token-reminder"
PLIST="$HOME/Library/LaunchAgents/${LABEL}.plist"
LOG="$HOME/Projects/launchd-reminders/logs/twitter-token.log"
+mkdir -p "$(dirname "$LOG")"
exec >> "$LOG" 2>&1
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] firing twitter-token reminder"
@@ -31,13 +32,16 @@ boot), but the underlying functional gap remains: the agent can't read tweets.
`pm2 delete norma-twitter && pm2 save`
EOF
-RESP=$(curl -sS -X POST 'http://localhost:9850/api/send' \
- -u 'admin:DWSecure2024!' \
- -H 'Content-Type: application/json' \
- -d "$(jq -n --arg to 'steve@designerwallcoverings.com' \
+PAYLOAD=$(jq -n --arg to 'steve@designerwallcoverings.com' \
--arg subject 'norma-twitter: still missing TWITTER_BEARER_TOKEN (1 week)' \
--arg body "$BODY" \
- '{to:$to, subject:$subject, body:$body}')" 2>&1)
+ '{to:$to, subject:$subject, body:$body}')
+# Run curl on its own line so $? reflects curl's exit code, not the assignment.
+# --fail makes HTTP 4xx/5xx a non-zero exit so a rejected send doesn't self-clean.
+RESP=$(curl -sS --fail -X POST 'http://localhost:9850/api/send' \
+ -u 'admin:DWSecure2024!' \
+ -H 'Content-Type: application/json' \
+ -d "$PAYLOAD" 2>&1)
RC=$?
echo "George response (rc=$RC): $RESP"
diff --git a/wolf-gordon-reauth-reminder.sh b/wolf-gordon-reauth-reminder.sh
index 7117754..0a0d5fe 100755
--- a/wolf-gordon-reauth-reminder.sh
+++ b/wolf-gordon-reauth-reminder.sh
@@ -8,6 +8,7 @@ LABEL="com.steve.wolf-gordon-reauth-reminder"
PLIST="$HOME/Library/LaunchAgents/${LABEL}.plist"
LOG="$HOME/Projects/launchd-reminders/logs/wolf-gordon-reauth.log"
+mkdir -p "$(dirname "$LOG")"
exec >> "$LOG" 2>&1
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] firing wolf-gordon-reauth reminder"
@@ -29,13 +30,16 @@ every swatch image (29 MB error log, 7 pm2 restarts in 147 min).
EOF
# Send via George — local Mac instance, NOT the Kamatera tailnet IP
-RESP=$(curl -sS -X POST 'http://localhost:9850/api/send' \
- -u 'admin:DWSecure2024!' \
- -H 'Content-Type: application/json' \
- -d "$(jq -n --arg to 'steve@designerwallcoverings.com' \
+PAYLOAD=$(jq -n --arg to 'steve@designerwallcoverings.com' \
--arg subject 'Re-eval Wolf Gordon trade auth (gemini-catalog-tagger was paused 2 weeks ago)' \
--arg body "$BODY" \
- '{to:$to, subject:$subject, body:$body}')" 2>&1)
+ '{to:$to, subject:$subject, body:$body}')
+# Run curl on its own line so $? reflects curl's exit code, not the assignment.
+# --fail makes HTTP 4xx/5xx a non-zero exit so a rejected send doesn't self-clean.
+RESP=$(curl -sS --fail -X POST 'http://localhost:9850/api/send' \
+ -u 'admin:DWSecure2024!' \
+ -H 'Content-Type: application/json' \
+ -d "$PAYLOAD" 2>&1)
RC=$?
echo "George response (rc=$RC): $RESP"
← 9433ab6 snapshot: 1 file(s) changed, +1 new
·
back to Launchd Reminders
·
(newest)