# Use the monitoring script
./queue-monitor.sh status
# Or check manually
php artisan queue:failed
ps aux | grep "queue:work"
Symptoms:
Solutions:
# Start queue worker
./queue-monitor.sh start
# Or manually
nohup php artisan queue:work --daemon > /dev/null 2>&1 &
# For production with systemd
sudo cp laravel-queue-worker.service /etc/systemd/system/
sudo systemctl enable laravel-queue-worker
sudo systemctl start laravel-queue-worker
Symptoms:
php artisan queue:failedSolutions:
# Retry all failed jobs
./queue-monitor.sh retry
# Or manually
php artisan queue:retry all
# Clear permanently failed jobs
./queue-monitor.sh clear
Symptoms:
Solutions:
# Restart queue worker
./queue-monitor.sh restart
# Process one job manually to see errors
./queue-monitor.sh process
Symptoms:
SendMatrixNotificationJob in failed jobsCommon Causes:
Route [single-memos.show] not defined- Fix: Already fixed in Activity model
```bash
# Check mail configuration
php artisan tinker
>>> config('mail')
```
```bash
# Fix log permissions
sudo chown -R www-data:www-data storage/logs/
chmod -R 775 storage/logs/
```
Symptoms:
AssignDocumentNumberJob in failed jobsCommon Causes:
- Fix: Clear old failed jobs
```bash
./queue-monitor.sh clear
```
```bash
# Test database connection
php artisan tinker
>>> DB::connection()->getPdo();
```
# Copy service file
sudo cp laravel-queue-worker.service /etc/systemd/system/
# Enable and start
sudo systemctl enable laravel-queue-worker
sudo systemctl start laravel-queue-worker
# Check status
sudo systemctl status laravel-queue-worker
# Install supervisor
sudo apt-get install supervisor
# Create configuration
sudo nano /etc/supervisor/conf.d/laravel-worker.conf
Add this content:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /opt/homebrew/var/www/staff/apm/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/opt/homebrew/var/www/staff/apm/storage/logs/worker.log
stopwaitsecs=3600
Then:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
# Add to crontab
crontab -e
# Add this line to run every minute
* * * * * cd /opt/homebrew/var/www/staff/apm && php artisan queue:work --once
# Monitor queue status
./queue-monitor.sh monitor
# Watch logs
tail -f storage/logs/laravel-$(date +%Y-%m-%d).log
# Check specific job processing
php artisan queue:work --once --verbose
# Check if worker is running
ps aux | grep "queue:work"
# Check failed jobs count
php artisan queue:failed | grep -c "database@default"
# Check queue size
php artisan tinker --execute="echo \App\Models\Job::count();"
# Test mail configuration
php artisan tinker
>>> Mail::raw('Test email', function($msg) { $msg->to('test@example.com')->subject('Test'); });
# Check mail logs
tail -f storage/logs/laravel-$(date +%Y-%m-%d).log | grep -i mail
.env file for correct SMTP configuration-- Check jobs table
SELECT * FROM jobs ORDER BY created_at DESC LIMIT 10;
-- Check failed_jobs table
SELECT * FROM failed_jobs ORDER BY failed_at DESC LIMIT 10;
-- Check job_batches table
SELECT * FROM job_batches ORDER BY created_at DESC LIMIT 10;
# Clear old completed jobs
php artisan queue:prune-batches --hours=24
# Clear old failed jobs
php artisan queue:prune-failed --hours=168 # 7 days
# Optimize for your server
php artisan queue:work \
--sleep=3 \
--tries=3 \
--max-time=3600 \
--memory=512 \
--timeout=60
# Run multiple workers for better performance
for i in {1..4}; do
nohup php artisan queue:work --sleep=3 --tries=3 > /dev/null 2>&1 &
done
```bash
df -h # Check disk space
free -m # Check memory
top # Check CPU usage
```
```bash
./queue-monitor.sh restart
```
```bash
./queue-monitor.sh clear
```
```bash
php artisan config:show mail
```
```bash
php artisan tinker
>>> Mail::raw('Test', function($msg) { $msg->to('your@email.com')->subject('Test'); });
```
```bash
tail -f storage/logs/laravel-$(date +%Y-%m-%d).log | grep -i "mail\|smtp\|phpmailer"
```
If you continue to have issues:
tail -f storage/logs/laravel-$(date +%Y-%m-%d).log./queue-monitor.sh statushtop or topphp artisan tinker then DB::connection()->getPdo()