Add cron-friendly report generation script
This commit is contained in:
parent
cb4ab29045
commit
e19138bc1a
2 changed files with 42 additions and 0 deletions
31
run-reports.sh
Executable file
31
run-reports.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Ensure virtual environment exists
|
||||
if [ ! -d ".venv" ]; then
|
||||
echo "[INFO] Creating virtual environment..."
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
echo "[INFO] Installing dependencies..."
|
||||
pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
echo "[WARN] requirements.txt not found, skipping."
|
||||
fi
|
||||
else
|
||||
echo "[INFO] Activating virtual environment..."
|
||||
source .venv/bin/activate
|
||||
fi
|
||||
|
||||
# Generate all reports
|
||||
echo "[INFO] Generating reports..."
|
||||
python scripts/generate_reports.py hourly
|
||||
python scripts/generate_reports.py daily
|
||||
python scripts/generate_reports.py weekly
|
||||
python scripts/generate_reports.py monthly
|
||||
|
||||
# Deactivate to keep cron environment clean
|
||||
if type deactivate >/dev/null 2>&1; then
|
||||
deactivate
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue