Skip to content

Instantly share code, notes, and snippets.

@ThatLadyDev
Created January 5, 2022 12:30
Show Gist options
  • Save ThatLadyDev/8b071692616ad88ce076a4a0e74325ea to your computer and use it in GitHub Desktop.
Save ThatLadyDev/8b071692616ad88ce076a4a0e74325ea to your computer and use it in GitHub Desktop.
How to setup supervisor after installation on centos environment
Run mkdir /etc/supervisor/ to create a directory to save configuration files.
Go to the newly created directory and run touch laravel-worker.conf (This creates a config file called laravel-worker, you can change this to another name of your choosing).
Once the laravel-worker.conf file is created. Edit its content (use sudo vim laravel-worker.conf) and enter the configuration as shown below:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /*Location to your laravel project*/artisan queue:work --tries=3
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-queue.log
Save the laravel-worker.conf, then go to the end of supervisord.conf and change the path as shown below.
[include]
files = /etc/supervisor/laravel-worker.conf
Run supervisord -c /etc/supervisord.conf. If it is started, use ps -ef to check PID and kill to finish the task.
To listen to tasks and keep the queue running, run the following commands:
systemctl enable supervisord
systemctl start supervisord
systemctl status supervisord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment