29 lines
776 B
Bash
Executable File
29 lines
776 B
Bash
Executable File
#!/bin/bash
|
|
# Weekly trend cron wrapper
|
|
# Run every Sunday at 08:00 UTC (16:00 Beijing)
|
|
|
|
set -e
|
|
|
|
PROJECT_DIR="$HOME/inspiration-collector"
|
|
LOG_FILE="$PROJECT_DIR/ai-insights/logs/weekly_trend.log"
|
|
|
|
mkdir -p "$(dirname "$LOG_FILE")"
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting weekly trend..." >> "$LOG_FILE"
|
|
|
|
cd "$PROJECT_DIR"
|
|
python3 analyzers/weekly_trend.py >> "$LOG_FILE" 2>&1
|
|
|
|
# Git push to Gitea
|
|
cd "$PROJECT_DIR"
|
|
if [[ -n $(git status --porcelain ai-insights/) ]]; then
|
|
git add ai-insights/
|
|
git commit -m "weekly trend W$(date '+%V')"
|
|
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')] Weekly trend done." >> "$LOG_FILE"
|