← back to Commercialrealestate
refresh: email steve-office (George) on sanity-gate abort or rsync failure
ce1d6f261fdb96eb14bc93cf2844eb82a3e7d4ff · 2026-07-07 06:36:50 -0700 · Steve Abrams
Silent-failure alerting for the 4x/day residential refresh — reuses the fleet's
canonical _shared/george-send.sh. Fires only on abort (bad scrape blocked) or
rsync-to-prod failure; clean runs stay silent. Recipient overridable via
RESIDENTIAL_REFRESH_TO. Verified via test send (success:true).
Files touched
M scripts/run-residential-refresh.sh
Diff
commit ce1d6f261fdb96eb14bc93cf2844eb82a3e7d4ff
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jul 7 06:36:50 2026 -0700
refresh: email steve-office (George) on sanity-gate abort or rsync failure
Silent-failure alerting for the 4x/day residential refresh — reuses the fleet's
canonical _shared/george-send.sh. Fires only on abort (bad scrape blocked) or
rsync-to-prod failure; clean runs stay silent. Recipient overridable via
RESIDENTIAL_REFRESH_TO. Verified via test send (success:true).
---
scripts/run-residential-refresh.sh | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/scripts/run-residential-refresh.sh b/scripts/run-residential-refresh.sh
index 6a78dfe..a3283ec 100755
--- a/scripts/run-residential-refresh.sh
+++ b/scripts/run-residential-refresh.sh
@@ -26,6 +26,17 @@ LOG=tmp/residential-refresh.log
mkdir -p tmp
echo "===== [$TS] residential refresh (LOCAL, \$0) =====" >> "$LOG"
+# Alert steve-office (George/Gmail) when a scheduled refresh fails silently — a bad scrape that the
+# sanity-gate blocks, or an rsync-to-prod failure. Reuses the fleet's canonical george-send.sh.
+ALERT_TO="${RESIDENTIAL_REFRESH_TO:-steve@designerwallcoverings.com}"
+send_alert() { # $1=subject $2=html-body
+ [ -f "$HOME/.claude/skills/_shared/george-send.sh" ] || { echo "[$(date '+%H:%M:%S')] no george-send.sh — alert skipped" >> "$LOG"; return; }
+ . "$HOME/.claude/skills/_shared/george-send.sh"
+ local resp; resp="$(george_send steve-office "$ALERT_TO" "$1" "$2")"
+ echo "$resp" | grep -q '"success":true' && echo "[$(date '+%H:%M:%S')] alert emailed to $ALERT_TO" >> "$LOG" \
+ || echo "[$(date '+%H:%M:%S')] alert email FAILED: $resp" >> "$LOG"
+}
+
# 1) Scrape condos (full sweep, local Chrome). Upserts cre.condo + rewrites data/condos-redfin.json.
echo "[$(date '+%H:%M:%S')] condos..." >> "$LOG"
node scripts/fetch-condos-redfin.js >> "$LOG" 2>&1
@@ -48,6 +59,8 @@ echo "[$(date '+%H:%M:%S')] snapshot counts — sfr=$SFR_N condo=$CONDO_N (rc: c
if [ "$SFR_N" -lt 5000 ] || [ "$CONDO_N" -lt 500 ]; then
echo "[$(date '+%H:%M:%S')] ABORT push — snapshot below sanity floor (sfr<5000 or condo<500). Keeping prod as-is." >> "$LOG"
+ send_alert "⚠ CRCP residential refresh ABORTED — bad scrape ($(date '+%Y-%m-%d %H:%M'))" \
+ "<div style=\"font-family:-apple-system,Helvetica,sans-serif;color:#222\"><h3 style=\"color:#b23b3b\">⚠ Residential refresh aborted — prod left untouched</h3><div>The scheduled Redfin scrape came back short, so the sanity-gate <b>blocked the push</b> to crcp.agentabrams.com (last good data is still live).</div><div style=\"margin:10px 0;padding:8px 12px;border:1px solid #eee;border-radius:6px\">SFR scraped: <b>$SFR_N</b> (floor 5000)<br>Condos scraped: <b>$CONDO_N</b> (floor 500)<br>rc: condo=$CONDO_RC sfr=$SFR_RC exp=$EXP_RC</div><div style=\"font-size:13px;color:#444\">Likely Redfin rate-limiting the local IP. Check <code>tmp/residential-refresh.log</code>. Next scheduled run may recover on its own; if it keeps aborting, dial the cron back to 2x/day.</div></div>"
exit 2
fi
@@ -57,4 +70,8 @@ rsync -az data/sfr-redfin.json data/condos-redfin.json \
"root@${DEPLOY_HOST}:${DEPLOY_PATH}/data/" >> "$LOG" 2>&1
RSYNC_RC=$?
echo "[$(date '+%H:%M:%S')] DONE — rsync rc=$RSYNC_RC · cost \$0 (local) · live: https://crcp.agentabrams.com/mls.html" >> "$LOG"
+if [ "$RSYNC_RC" -ne 0 ]; then
+ send_alert "⚠ CRCP residential refresh — rsync to prod FAILED ($(date '+%Y-%m-%d %H:%M'))" \
+ "<div style=\"font-family:-apple-system,Helvetica,sans-serif;color:#222\"><h3 style=\"color:#b23b3b\">⚠ Fresh data scraped but not pushed</h3><div>The local scrape succeeded (SFR <b>$SFR_N</b>, condos <b>$CONDO_N</b>) but the rsync to Kamatera <b>failed</b> (rc=$RSYNC_RC). The live site is showing the previous snapshot.</div><div style=\"font-size:13px;color:#444;margin-top:8px\">Check SSH/network to root@$DEPLOY_HOST and <code>tmp/residential-refresh.log</code>.</div></div>"
+fi
exit $RSYNC_RC
← 843d559 mls: rename browser title -> 'LA County MLS — Residential +
·
back to Commercialrealestate
·
residential: off-market tracking — see pulled listings, labe 2d64c25 →