Files

23 lines
730 B
Bash
Raw Permalink Normal View History

2026-04-04 18:52:19 +03:00
#!/bin/bash
#
# Queue Worker Script for JobifyGarden
# This script runs the queue worker and ensures it doesn't run if already running
#
# Get the directory where this script is located
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
# Check if queue worker is already running
if pgrep -f "artisan queue:work" > /dev/null; then
echo "Queue worker already running, skipping..."
exit 0
fi
# Run the queue worker
# --max-time=50 ensures it runs for max 50 seconds
# --stop-when-empty exits when queue is empty
# --sleep=3 waits 3 seconds between jobs
# --tries=3 retries failed jobs 3 times
php artisan queue:work --max-time=50 --stop-when-empty --sleep=3 --tries=3 >> storage/logs/queue-worker.log 2>&1