forked from minzeyaphyo/burmddit
✅ Trigger redeploy: Category pages + Quality control
This commit is contained in:
41
run-daily-pipeline.sh
Executable file
41
run-daily-pipeline.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# Burmddit Daily Content Pipeline
|
||||
# Runs at 9:00 AM UTC+8 (Singapore time) = 1:00 AM UTC
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
BACKEND_DIR="$SCRIPT_DIR/backend"
|
||||
LOG_FILE="$SCRIPT_DIR/logs/pipeline-$(date +%Y-%m-%d).log"
|
||||
|
||||
# Create logs directory
|
||||
mkdir -p "$SCRIPT_DIR/logs"
|
||||
|
||||
echo "====================================" >> "$LOG_FILE"
|
||||
echo "Burmddit Pipeline Start: $(date)" >> "$LOG_FILE"
|
||||
echo "====================================" >> "$LOG_FILE"
|
||||
|
||||
# Change to backend directory
|
||||
cd "$BACKEND_DIR"
|
||||
|
||||
# Activate environment variables
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
|
||||
# Run pipeline
|
||||
python3 run_pipeline.py >> "$LOG_FILE" 2>&1
|
||||
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "✅ Pipeline completed successfully at $(date)" >> "$LOG_FILE"
|
||||
else
|
||||
echo "❌ Pipeline failed with exit code $EXIT_CODE at $(date)" >> "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "====================================" >> "$LOG_FILE"
|
||||
echo "" >> "$LOG_FILE"
|
||||
|
||||
# Keep only last 30 days of logs
|
||||
find "$SCRIPT_DIR/logs" -name "pipeline-*.log" -mtime +30 -delete
|
||||
|
||||
exit $EXIT_CODE
|
||||
Reference in New Issue
Block a user