---
type: "Source File"
title: "!/bin/bash"
description: "#!/bin/bash # daily_update.sh — Fetch fresh data + generate oracle commentary # Runs via systemd timer daily at 06:00 UTC set -uo pipefail cd /home/ben/infra/copecheck-data source venv/bin/activate."
resource: "https://data.copecheck.com"
tags: ["copecheck", "data", "source-file", "sh"]
timestamp: "2026-08-24T09:47:24Z"
site: "data"
source_path: "copecheck-data/daily_update.sh"
---

# !/bin/bash

Source path: `copecheck-data/daily_update.sh`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-08-24T09:47:24Z`

```sh
#!/bin/bash
# daily_update.sh — Fetch fresh data + generate oracle commentary
# Runs via systemd timer daily at 06:00 UTC

set -uo pipefail
cd /home/ben/infra/copecheck-data
source venv/bin/activate

LOG="logs/daily_$(date +%Y%m%d).log"
echo "=== Daily update started $(date) ===" >> "$LOG"

# Step 1: Fetch fresh data from World Bank, Eurostat, BLS
echo "Fetching data..." >> "$LOG"
fetch_status=0
python3 data_fetcher.py >> "$LOG" 2>&1 || fetch_status=$?
if [ "$fetch_status" -ne 0 ]; then
  echo "Data fetch had errors (exit $fetch_status)" >> "$LOG"
fi

# Step 2: Score 15 unscored combos (or rescore old ones)
echo "Running oracle scoring..." >> "$LOG"
score_status=0
python3 oracle_commentary.py --batch 15 >> "$LOG" 2>&1 || score_status=$?
if [ "$score_status" -ne 0 ]; then
  echo "Oracle scoring had errors (exit $score_status)" >> "$LOG"
fi

echo "=== Daily update finished $(date) ===" >> "$LOG"

# Surface partial source or commentary failures to systemd/monitoring instead of
# recording a false-success timer run.
if [ "$fetch_status" -ne 0 ] || [ "$score_status" -ne 0 ]; then
  exit 1
fi
```
