Files
river-monitor/synology-task.sh
Simon Moore fd11c956d0 Add --no-html flag and Synology Task Scheduler setup
--no-html skips dashboard generation for deployments where river.php
reads the SQLite DB directly. synology-task.sh is a ready-to-configure
wrapper for DSM Task Scheduler.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 00:36:07 +01:00

22 lines
863 B
Bash

#!/bin/sh
# River monitor poller — run this via Synology Task Scheduler every 15 minutes.
#
# Setup:
# 1. Copy river_monitor.py to your Synology (e.g. /volume1/homes/simon/river_monitor.py)
# 2. Set WEB_DATA_DIR below to the data/ folder inside your web repo on the Synology
# 3. In DSM: Control Panel → Task Scheduler → Create → Scheduled Task → User-defined script
# - User: your DSM user (needs write access to WEB_DATA_DIR)
# - Schedule: every 15 minutes
# - Task: sh /volume1/homes/simon/synology-task.sh
# 4. Run once manually with --backfill to populate history, then let the schedule take over
SCRIPT=/volume1/homes/simon/river_monitor.py
WEB_DATA_DIR=/volume1/web/data
DB=$WEB_DATA_DIR/river_levels.db
LOG=$WEB_DATA_DIR/river-monitor.log
/usr/bin/python3 "$SCRIPT" \
--db "$DB" \
--no-html \
>> "$LOG" 2>&1