#!/bin/bash

# BondaCare Queue Worker Cron Job
# This script ensures the queue worker is always running

# Change to your project directory
cd /home/your-username/public_html/bondacare

# Check if queue worker is already running
if ! pgrep -f "artisan queue:work" > /dev/null
then
    # Start the queue worker if it's not running
    /usr/bin/php artisan queue:work --daemon --sleep=3 --tries=3 --timeout=60 >> storage/logs/queue-worker.log 2>&1 &
    echo "Queue worker started at $(date)" >> storage/logs/queue-worker.log
else
    echo "Queue worker already running at $(date)" >> storage/logs/queue-worker.log
fi
