fleettickets/run_ingest.sh
david kiania 7d3bba8d78 chore(schedule): INC ingest cron -> every 20 min, 06:00-20:40 EAT
Was hourly at :15 (15 7-19 * * *); now */20 6-20 * * * for fresher ticket
data through the working day. Updates the documented schedule in the Coolify
Scheduled Task command, run_ingest.sh, Dockerfile, README, and implementation
notes (the live schedule is set in the Coolify UI).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 18:23:17 +03:00

27 lines
978 B
Bash
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# run_ingest.sh — fleettickets · hourly INC ingest wrapper for cron.
#
# Loads env from the local .env (DATABASE_URL + RUSTFS_* + GEOCODER_*) and runs the
# newest-INC-CSV ingest with --apply (skip-if-unchanged + archive are built in).
#
# Install on the instance (ingest every 20 min, 06:0020:40 EAT):
# */20 6-20 * * * /opt/fleettickets/run_ingest.sh >> /var/log/fleettickets-inc.log 2>&1
# Ensure the crontab runs in the Africa/Nairobi timezone (CRON_TZ=Africa/Nairobi or
# the host/container TZ), since the export filenames and the schedule are EAT.
set -euo pipefail
cd "$(dirname "$0")"
# Load .env if present (KEY=VALUE lines); never commit the real .env.
if [ -f .env ]; then
set -a
# shellcheck disable=SC1091
. ./.env
set +a
fi
# Prefer the project venv if it exists, else the python on PATH (e.g. in-container).
PY="python"
[ -x ".venv/bin/python" ] && PY=".venv/bin/python"
exec "$PY" import_tickets.py --from-bucket --apply