19 lines
621 B
Bash
19 lines
621 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Install supercronic if missing
|
||
|
|
if ! command -v supercronic >/dev/null 2>&1; then
|
||
|
|
curl -fsSL -o /usr/local/bin/supercronic \
|
||
|
|
https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64
|
||
|
|
chmod +x /usr/local/bin/supercronic
|
||
|
|
fi
|
||
|
|
|
||
|
|
cat >/app/crontab <<'EOF'
|
||
|
|
# HOURLY job (every hour on the hour)
|
||
|
|
0 * * * * python /app/arcwater_to_influx.py --granularity HOURLY --days-back 30
|
||
|
|
|
||
|
|
# DAILY job 4 times/day (00:05, 06:05, 12:05, 18:05)
|
||
|
|
5 0,6,12,18 * * * python /app/arcwater_to_influx.py --granularity DAILY --days-back 30
|
||
|
|
EOF
|
||
|
|
|
||
|
|
exec supercronic /app/crontab
|