Run Your Laravel Queue workers on shared hosting with using cron jobs.
Tired of using cron jobs to run your to run your jobs in queue in laravel , try this , a single command that will change your game .
Topics
Keep Your Laravel Queue Running on Shared Hosting (Because Supervisors are for Quitters)
Your Laravel app needs to send emails, process images, sync data — all the boring stuff that'll freeze your request if you do it synchronously. Enter queues. But there's a catch: shared hosting doesn't have supervisor (cry). So you'll use nohup — the Unix equivalent of telling a process, "keep running, I'm leaving now."
The 30-Second Setup
SSH into your server and run this one-liner:
Done. Your queue is now running in the background. The process will keep working even after you disconnect.
What Did I Just Do?
- nohup = "don't kill this when I log out"
- --timeout=60 = kill jobs that take longer than 60 seconds (prevent zombies)
- --sleep=3 = check for new jobs every 3 seconds (balance CPU vs. responsiveness)
- >> storage/logs/queue-worker.log 2>&1 = dump all output to a log file
- & = run in background
It'll print your process ID (PID). Save it somewhere safe — you'll need it to kill the worker later.
Is It Actually Running?
Check if it's alive:
Or stalk the logs in real time:
If you see jobs being processed, congrats — you're a queue wizard now.
The Crash Problem (aka Auto-Restart)
Here's the thing: your queue worker might crash. Database locks, memory leaks, cosmic rays — who knows. On shared hosting, there's no supervisor to restart it automatically. So use a cron job watchdog.
Create a file called check-queue.sh in your project root:
Make it executable:
Then add it to crontab (runs every 5 minutes):
Add this line:
Now if your worker dies, it automatically restarts within 5 minutes. You're basically letting a robot babysit your queue.
How to Kill It (When Things Go Wrong)
Find the PID:
Kill it gracefully:
Or nuke it from orbit (if graceful doesn't work):
Then restart:
Common Disasters & How to Fix Them
❌ "Command not found: php"
Use the full path: nohup /usr/bin/php artisan queue:work .... Find it with which php.
❌ Worker stops after one job
Check the logs: tail -50 storage/logs/queue-worker.log. Probably a database connection timeout or missing env vars.
❌ Too many queue processes running
You started it three times by accident. Kill all PHP processes (carefully): killall php. Or kill specific PIDs one by one.
❌ Server rebooted, queue is gone
You need to manually restart it or add a cron job that runs hourly to ensure it stays alive.
The Cheat Sheet
That's it. Your Laravel queue is now running 24/7 on budget shared hosting. No fancy services, no Supervisor, just good old Unix magic and a cron job babysitter. Sleep soundly.
Discussion
Comments
0 comments
Loading comments...
Recommended Blogs
Continue Reading
18 May 2026
The Meta AI incognito chat will blow your mind
The Meta AI incognito chat is allowing people to privately.....
17 May 2026
Why Everyone Suddenly Wont Shut Up About ASML 🔬
ASML doesn't make AI. It makes the machines that make AI possible — and that's...
12 May 2026
iOS 26.5: Apples New Features… and Their Secret Master Plan
Apple's iOS 26.5 is here with RCS upgrades, smarter Maps, and AI features — but...
Stay Connected
Follow and Explore More
Watch more on YouTube, explore the rest of the brand, and jump back to the homepage to discover ideas, projects, and more.
Sign in with Google to join the discussion.