32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Weekly digest cron wrapper
|
|
# Run every Sunday at 08:00 UTC (16:00 Beijing)
|
|
# Synthesizes 7 daily digests into a week-level analysis report
|
|
#
|
|
# Scheduled earlier than the daily digest (22:00) to ensure
|
|
# the most recent daily digest has already been generated.
|
|
|
|
set -e
|
|
|
|
PROJECT_DIR="$HOME/inspiration-collector"
|
|
LOG_FILE="$PROJECT_DIR/ai-insights/logs/weekly_digest.log"
|
|
|
|
mkdir -p "$(dirname "$LOG_FILE")"
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting weekly digest synthesis..." >> "$LOG_FILE"
|
|
|
|
cd "$PROJECT_DIR"
|
|
/usr/bin/python3 analyzers/weekly_digest.py >> "$LOG_FILE" 2>&1
|
|
|
|
# Git push handled inside weekly_digest.py (git_push_weekly)
|
|
# Duplicate push here as safety net in case the script's push failed
|
|
cd "$PROJECT_DIR"
|
|
if [[ -n $(git status --porcelain ai-insights/) ]]; then
|
|
git add ai-insights/
|
|
git commit -m "weekly digest W$(date '+%V') - safety push"
|
|
git push origin main 2>&1 | tail -3 >> "$LOG_FILE"
|
|
echo "Safety push done" >> "$LOG_FILE"
|
|
fi
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Weekly digest done." >> "$LOG_FILE"
|