1. Install a supervisor
In Amazon repository, there is no supervisor. So we should use
epelrepository to install that.
sudo yum --enablerepo=epel install supervisor
2. Start supervisor
sudo service supervisord start
If you get this sentence
Redirecting to /bin/systemctl start supervisord.service, install was succeed.
3. Modify the supervisor config file
To add worker to supervisor, we should modify the supervisor config file.
sudo vi /etc/supervisord.conf
And add these contents.
command=php /project-home/artisan queue:work
Please do not forget to add
worker.log file into your log path.
4. Read supervisor config file
To read your new config file to supervisor, execute this command.
sudo supervisorctl reread
If you wrote config correctly, you could get this message.
5. Restart supervisor
To apply your new config to supervisor, execute this command.
sudo service supervisord restart
And check worker is working.
sudo supervisorctl status
You can get this message. (probably your pid and uptime is different for me.)
worker:worker_00 RUNNING pid 1043936, uptime 0:00:10
worker:worker_01 RUNNING pid 1043937, uptime 0:00:10
6. Add supervisor auto restart config
sudo chkconfig supervisord on