← back to Commercialrealestate

5x/health-check.sh

13 lines

#!/bin/sh
# Periodic overnight health check — verifies the server is up + ALL strong gates still PASS.
# Run: sh 5x/health-check.sh   (exit 0 = healthy)
cd "$(dirname "$0")/.."
code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9911/crcp.html 2>/dev/null)
[ "$code" = "200" ] || { echo "SERVER DOWN ($code) — restart: node scripts/serve.js &"; exit 1; }
fail=0
for g in deals map crcp sales brokers index rentrolls; do
  if node "5x/$g-assert.js" >/dev/null 2>&1; then echo "  $g-assert: PASS"; else echo "  $g-assert: FAIL"; fail=1; fi
done
[ $fail = 0 ] && echo "ALL GATES PASS — healthy" || echo "REGRESSION DETECTED"
exit $fail