fix(scripts): Telegram pipeline summary — timestamp compare, retries, diagnostics

- Normalize SQLite vs ISO discoveredAt for run-window filtering
- Retry jobs list after run; compressed JSON requests
- Cross-check GET /api/jobs/revision when list is empty
- Docs: cron at 9/13/18, pull + redeploy steps for VM

Made-with: Cursor
This commit is contained in:
2026-04-04 22:03:53 -04:00
parent 8a08d4991e
commit b2a2507615
2 changed files with 78 additions and 11 deletions
+16 -2
View File
@@ -170,12 +170,26 @@ Fill **`TELEGRAM_BOT_TOKEN`** (from @BotFather) and **`TELEGRAM_CHAT_ID`**. For
You should get one Telegram when the pipeline finishes. Optional log: append `>> /var/log/jobber-pipeline.log 2>&1` on the cron line.
**4. Cron** (example: 08:00, 14:00, 20:00 host local time — `crontab -e`):
**4. Cron** (host **local** timezone — check with `timedatectl` — `crontab -e` as root):
```cron
0 8,14,20 * * * /usr/local/bin/jobber-pipeline-telegram.sh >> /var/log/jobber-pipeline.log 2>&1
# 09:00, 13:00, 18:00 daily — pipeline + Telegram summary
0 9,13,18 * * * /usr/local/bin/jobber-pipeline-telegram.sh >> /var/log/jobber-pipeline.log 2>&1
```
Other examples: `0 8,14,20 * * *` for 08:00 / 14:00 / 20:00.
**5. Pull latest code and redeploy** (on the VM, from the repo root, e.g. `/opt/Jobber`):
```bash
cd /opt/Jobber
git fetch origin && git pull --ff-only
install -m 755 scripts/jobber-pipeline-telegram.sh /usr/local/bin/jobber-pipeline-telegram.sh
docker compose up -d --build
```
Wait until `curl -sf http://127.0.0.1:3005/health` succeeds before relying on cron (container needs a few seconds after start).
**Security:** Never commit `/root/.jobber-cron.env` or paste bot tokens in Git. Revoke the token in BotFather if it was exposed.
### Option B2 — Minimal curl-only (no wait-for-finish)