Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Hitostacha's avatar

Dispatching jobs on deployment

I'm setting up a web for deployment, but there's something I came across with that I can't find information about, it's setting up a daemon for queue:work, I made a job that handles everything, I uploaded everything to the server, but what I can't figure out is how to run queue:workon the server, should I use a cron job (provided by cPanel) or run the command via ssh?

0 likes
4 replies
bobbybouwmann's avatar

You should be using a tool like supervisor for that. This will ensure that queue:work is running all the time. If it fails to run supervisor will make sure it will start it up again as well ;)

Documentation: https://laravel.com/docs/5.6/queues#supervisor-configuration

Make sure that you restart supervisor after/during the deployment. If you don't your queue might not work correctly because the code will not be refreshed! So that is an important step to take!

Let me know if this works for you ;)

2 likes
Hitostacha's avatar

I just got the time to check your answer, sorry for the wait!

I can't install supervisoras I'm working on a shared hosting, I've read somewhere else that I can set up a cron job to restart/start the queue with the database driver (it's the one I'm using right now), how can I possibly do that? With Laravel's Task Scheduling?

bobbybouwmann's avatar

@Hitostacha You can run a single cronjob using the Task Scheduling tool. However your shared hosting should allow you to create a cronjob as well. If you can't install supervisor I also don't expect you will be able to run a cronjob.

It might be better to either synchronously run your jobs instead of queuing them or move to an environment where you actually can run this!

Please or to participate in this conversation.