diff --git a/deploy/wizwar-rollup.sh b/deploy/wizwar-rollup.sh index 84d43c9..b39bdd4 100755 --- a/deploy/wizwar-rollup.sh +++ b/deploy/wizwar-rollup.sh @@ -14,7 +14,14 @@ OUT="/var/lib/wizwar/rollup.jsonl" LOG="/var/log/wizwar/rollup.log" DAY="${1:-$(date -u -d 'yesterday' +%Y-%m-%d)}" CRON_URL=$(cat /root/.wizwar-sentry-cron-rollup 2>/dev/null || true) -checkin() { [ -n "$CRON_URL" ] && curl -sf -o /dev/null "$CRON_URL?status=$1" || true; } +# The check-in carries the schedule: Sentry only keeps a monitor it has +# been told the shape of, and a bare ping to an unknown slug is accepted +# and dropped without a word. +checkin() { + [ -n "$CRON_URL" ] && curl -sf -o /dev/null -X POST -H "Content-Type: application/json" \ + -d "{\"status\":\"$1\",\"monitor_config\":{\"schedule\":{\"type\":\"crontab\",\"value\":\"10 0 * * *\"},\"checkin_margin\":30,\"max_runtime\":10,\"timezone\":\"UTC\"}}" \ + "$CRON_URL" || true +} checkin in_progress if python3 - "$DAY" "$OUT" <<'PY' >> "$LOG" 2>&1