• Created automated setup_embedding_cron_auto.sh script that fully configures cron jobs without manual intervention • Enhanced embedding pipeline logging and error handling • Simplified AI processor to focus on core fact extraction functionality • Added proper logging to all scripts for better monitoring
64 lines
2.2 KiB
Bash
Executable File
64 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Automated setup script for embedding pipeline cron job
|
|
# This script automatically configures the cron job to run the embedding pipeline periodically
|
|
|
|
echo "=============================================="
|
|
echo "Automated Embedding Pipeline Cron Setup"
|
|
echo "=============================================="
|
|
|
|
# Get the directory where this script is located
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
echo "Script directory: $SCRIPT_DIR"
|
|
|
|
# Make the pipeline script executable
|
|
chmod +x "$SCRIPT_DIR/run_embedding_pipeline.sh"
|
|
echo "✓ Made pipeline script executable"
|
|
|
|
# Check if crontab is available
|
|
if ! command -v crontab &> /dev/null; then
|
|
echo "✗ Error: crontab is not available on this system"
|
|
exit 1
|
|
fi
|
|
|
|
# Define the cron job entry
|
|
CRON_ENTRY="*/10 * * * * cd $SCRIPT_DIR && ./run_embedding_pipeline.sh >> $SCRIPT_DIR/cron.log 2>&1"
|
|
|
|
# Check if this cron job is already installed
|
|
if crontab -l 2>/dev/null | grep -q "embedding_pipeline"; then
|
|
echo "⚠ Warning: Embedding pipeline cron job already exists. Removing existing entry..."
|
|
crontab -l 2>/dev/null | grep -v "embedding_pipeline" | crontab -
|
|
fi
|
|
|
|
# Add the cron job
|
|
echo "Adding cron job entry..."
|
|
(crontab -l 2>/dev/null; echo "$CRON_ENTRY") | crontab -
|
|
echo "✓ Cron job added successfully"
|
|
|
|
# Verify the cron job was added
|
|
if crontab -l 2>/dev/null | grep -q "embedding_pipeline"; then
|
|
echo "✓ Verification: Cron job successfully installed"
|
|
else
|
|
echo "✗ Error: Failed to verify cron job installation"
|
|
exit 1
|
|
fi
|
|
|
|
# Create log directory if it doesn't exist
|
|
mkdir -p "$SCRIPT_DIR/logs"
|
|
echo "✓ Created logs directory"
|
|
|
|
# Create a simple status file to track setup
|
|
echo "Embedding pipeline cron job configured on $(date)" > "$SCRIPT_DIR/.cron_setup_status"
|
|
echo "✓ Created setup status file"
|
|
|
|
echo "=============================================="
|
|
echo "Setup Complete!"
|
|
echo "The embedding pipeline will now run every 10 minutes"
|
|
echo "Check logs in: $SCRIPT_DIR/logs/"
|
|
echo "Cron job status: $(crontab -l | grep embedding_pipeline)"
|
|
echo "=============================================="
|
|
|
|
# Display current cron jobs for verification
|
|
echo ""
|
|
echo "Current cron jobs:"
|
|
crontab -l |