File size: 1,288 Bytes
25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
#!/bin/bash
# Script to start Celery components
# Check if we're in the right directory
if [ ! -f "app.py" ]; then
echo "Please run this script from the backend directory"
exit 1
fi
# Function to start Celery worker
start_worker() {
echo "Starting Celery worker..."
python start_celery.py worker &
echo "Celery worker started with PID $!"
}
# Function to start Celery Beat scheduler
start_beat() {
echo "Starting Celery Beat scheduler..."
python start_celery.py beat &
echo "Celery Beat scheduler started with PID $!"
}
# Function to start both worker and beat
start_all() {
start_worker
start_beat
}
# Function to check system requirements
check_requirements() {
echo "Checking system requirements..."
python start_celery.py check
}
# Main script logic
case "$1" in
worker)
start_worker
;;
beat)
start_beat
;;
all)
start_all
;;
check)
check_requirements
;;
*)
echo "Usage: $0 {worker|beat|all|check}"
echo " worker - Start Celery worker"
echo " beat - Start Celery Beat scheduler"
echo " all - Start both worker and scheduler"
echo " check - Check system requirements"
exit 1
;;
esac |