Guide Guide: running Laravel scheduled tasks on shared hosting

AaravM 1 reply 704 views 2 participants
#1
Shared hosting usually gives you cron but no supervisor. Here is a setup that works well:

1. One cron line
Code
* * * * * /usr/local/bin/php /home/USER/app/artisan schedule:run >> /dev/null 2>&1


2. Database queue processed by the scheduler
PHP
Schedule::command('queue:work --stop-when-empty --max-time=50')->everyMinute()->withoutOverlapping();


3. Check it works
Add a test job, wait a minute, then look at the jobs table. Done! 🚀
#2
Exactly how I do it. The --max-time option keeps it under the cron interval.

Join the conversation — sign in or create a free account to reply.

Chat with us
Hi! Send us a message and we will reply here as soon as we can.