31 lines
804 B
Bash
Executable File
31 lines
804 B
Bash
Executable File
#!/bin/bash
|
|
# Daily digest cron wrapper
|
|
# Run daily at 14:00 UTC (22:00 Beijing)
|
|
|
|
set -e
|
|
|
|
PROJECT_DIR="$HOME/inspiration-collector"
|
|
LOG_FILE="$PROJECT_DIR/ai-insights/logs/daily_digest.log"
|
|
|
|
mkdir -p "$(dirname "$LOG_FILE")"
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting daily digest..." >> "$LOG_FILE"
|
|
|
|
cd "$PROJECT_DIR"
|
|
python3 analyzers/daily_digest.py >> "$LOG_FILE" 2>&1
|
|
|
|
# Git push to Gitea
|
|
cd "$PROJECT_DIR"
|
|
|
|
# Check if there are changes
|
|
if [[ -n $(git status --porcelain ai-insights/) ]]; then
|
|
git add ai-insights/
|
|
git commit -m "daily digest $(date '+%Y-%m-%d')"
|
|
git push origin main 2>&1 | tail -3 >> "$LOG_FILE"
|
|
echo "Pushed to Gitea" >> "$LOG_FILE"
|
|
else
|
|
echo "No changes to push" >> "$LOG_FILE"
|
|
fi
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Daily digest done." >> "$LOG_FILE"
|