2.0 KiB
Cron jobs for Degelas data updates
The backend already runs an in-app scheduler (every 6 hours) for prices and metrics. Host cron adds a second trigger so data stays up to date even after restarts and keeps electricity forecasts ahead.
What gets updated
| Job | Effect |
|---|---|
| prices | Full electricity price refresh (21-day window from spot API) + baseline price predictions. Run after day-ahead publication (~12–13 CET). |
| metrics | Solar/weather metrics for all locations (Open-Meteo). Run every 6 h. |
Setup
-
Make the script executable:
chmod +x /root/solar_trading_engine/scripts/cron-refresh.sh -
Install cron entries (choose one):
Option A – user crontab
crontab -ePaste the lines from
scripts/crontab.example(adjust paths if needed).Option B – system cron file
sudo cp /root/solar_trading_engine/scripts/crontab.example /etc/cron.d/degelas-refresh sudo chmod 644 /etc/cron.d/degelas-refreshEdit
/etc/cron.d/degelas-refreshand fix the path tocron-refresh.shand the log file path. Ensure the file ends with a newline. -
(Optional) Create log file and allow cron to write to it:
sudo touch /var/log/degelas-cron.log sudo chown $(whoami) /var/log/degelas-cron.log
Suggested schedule
- Prices: 12:05 and 18:05 UTC (13:05 and 19:05 CET in winter) so runs are after day-ahead publication.
- Metrics: Every 6 hours (
0 */6 * * *).
Times in crontab.example are in UTC. To use local time (e.g. CET), set TZ=Europe/Brussels at the top of the crontab or in the cron.d file.
Manual run
# Prices only (full 21-day + baseline)
/root/solar_trading_engine/scripts/cron-refresh.sh prices
# Metrics only (all locations)
/root/solar_trading_engine/scripts/cron-refresh.sh metrics
# Both
/root/solar_trading_engine/scripts/cron-refresh.sh all
Requires the degelas-backend container to be running (docker compose up -d from the project root).