mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 14:37:50 +01:00
evig-cron@timecard-reminders.service went red on 2026-09-10 and stayed red. Nothing was broken. The box booted at 08:01:48 UTC. `Persistent=true` makes systemd fire every schedule missed while the box was off the moment it comes back, so the 08:00 run caught up at 08:01:58 — the same second evig-app.service started. Next bound :4004 at 08:02:00. curl got connection-refused in between, `set -e` turned curl's exit 7 into run-cron.sh's exit status, and because this is a *daily* timer the unit then sat `failed` until the next morning: an incident page for a two-second race, and one day of reminders silently skipped. `After=evig-app.service` cannot fix this — it orders the timer after the app unit's *start*, never its readiness. So run-cron.sh now waits for the app it is supposed to call: retry ONLY curl's exit 7 (10 attempts, 6s apart, bounded well inside TimeoutStartSec=180), and log each wait so it is not a silent hang. A real HTTP status still fails on the first response — a broken endpoint stays exactly as loud as it was. Two smaller things in the same file: `set -e` would have killed the run before curl if CRON_SECRET were ever unset (the `[ -n ... ] && hdr=(...)` one-liner is the script's exit status when the test is false), and a connection failure used to produce no journal line at all. The Never-Twice half: scripts/ci/test-run-cron.sh drives the script against a fake app that binds late, one that answers 500, and one that never comes up, and asserts the retry is spent on exactly one of them. Wired into `verify` as `test:ops`, so CI runs it. Verified it fails against the pre-fix script. Editing this file changes nothing on the box — the deploy only rsyncs the standalone build — so the README's install block is now flagged as the only channel that ships it, and it must be re-run. Claude-Session: https://claude.ai/code/session_014FMEgKPDG3iMFExEvdJzWy Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>