In most cases you’d use supervisor.d or some other monitoring daemon to after queue worker process in Laravel applications, However the propose of this post is just to say that you can use PM2 to run and monitor your artisan process.
Basically the reason I go with pm2 is that I have few nodejs scripts running on my server so it would be a good reason to use pm2 for running my queue runner.
To get pm2 to run artisan run following command:
pm2 start artisan --name laravel-worker --interpreter php -- queue:work --daemon
This would run a pm2 process named laravel-worker which you can then see in your pm2 list output.
if you are not yet running pm2 in start up make sure you run pm2 startup to ensure your processes run once your machine is rebooted.
Incoming search terms:
- laravel queue pm2
- pm2 laravel
- pm2 laravel queue
- pm2 php supervisor vs
- queue listen with pm2