I want my laravel queue:work to keep running on a shared hosting, this is a shared hosting (am not on a VPS) I can't install anything because almost all online sources when I was searching for this suggest installing supervisor. So basically I thought I could just create a cron job that checks if queue is not running and starts it, any help on how to go about this because am kinda stuck, thanks.
P.S. Am on a Linux server and Laravel 5.3
With Laravel 8 you have the option --max-time
for queue:work
that allows it to stop job processing after some amount of time.
php artisan queue:work --max-time=300
You can setup a cron job, for example, every 5 minutes to run job processing and set the --max-time
option to 5 minutes (300 seconds). In that case, cron will run job processing, after 300 seconds queue:work
will exit, and, in a couple of seconds, cron will run job processing again, and so on.
As you mentioned you are using shared hosting, You follow the below steps.
Step 1.
you need to setup your queue driver as database
Step 2
you need to setup a cron job with with the following command
php /path/to/application/artisan queue:work --queue=high,default
.
You can give a try. I hope it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With