diff --git a/README.md b/README.md index 6adbc9c..a5a6fbe 100644 --- a/README.md +++ b/README.md @@ -153,21 +153,38 @@ regardless of whether anything has actually delivered it yet. [stacks/infra/scripts/process-cron.sh](stacks/infra/scripts/process-cron.sh) calls both endpoints for **every** business under `STACKS_DIR` in one run, so a single crontab entry covers businesses added later too — no -per-business cron line to maintain. Add this to the VPS's crontab -(`crontab -e`) once: +per-business cron line to maintain. + +Many minimal cloud VPS images (including some Debian ones) don't ship +`cron` at all — `crontab -e` failing with `command not found` means this +first: + +```bash +sudo apt update && sudo apt install -y cron +sudo systemctl enable --now cron +``` + +Then add this to the VPS's crontab (`crontab -e`) once — **not** `sudo +crontab -e`: run it as the same non-root user that already owns +`/opt/nextchair` (the one you've been running `git pull`/`docker build` +as), so the log file below is writable without needing root: ```bash # Deliver queued notifications every 2 minutes. -*/2 * * * * STACKS_DIR=/opt/nextchair/stacks /opt/nextchair/stacks/infra/scripts/process-cron.sh notifications >> /var/log/nextchair-cron.log 2>&1 +*/2 * * * * STACKS_DIR=/opt/nextchair/stacks /opt/nextchair/stacks/infra/scripts/process-cron.sh notifications >> /opt/nextchair/nextchair-cron.log 2>&1 # Refresh Google Reviews once a day. -0 3 * * * STACKS_DIR=/opt/nextchair/stacks /opt/nextchair/stacks/infra/scripts/process-cron.sh reviews >> /var/log/nextchair-cron.log 2>&1 +0 3 * * * STACKS_DIR=/opt/nextchair/stacks /opt/nextchair/stacks/infra/scripts/process-cron.sh reviews >> /opt/nextchair/nextchair-cron.log 2>&1 ``` -(Adjust `STACKS_DIR` if you cloned this repo somewhere other than -`/opt/nextchair`.) To confirm it's working, or to flush a notification -that's stuck pending right now, run either line's command by hand and -check `/var/log/nextchair-cron.log` — a healthy run logs ` +(Adjust `STACKS_DIR`/the log path if you cloned this repo somewhere other +than `/opt/nextchair`, or don't have write access to it — `/var/log/` +itself is **not** a safe default here: it needs root, and a crontab +entry that can't write its own log file just silently produces no file +at all, which looks identical to "the job never ran.") To confirm it's +working, or to flush a notification that's stuck pending right now, run +either line's command by hand and check +`/opt/nextchair/nextchair-cron.log` — a healthy run logs ` process-notifications ok` for every business. ## Updating after a code change