Install
sudo apt-get install supervisor
Getting started
sudo service supervisor restart
Adding a Program
Supervisor
program configurations are in /etc/supervisor/conf.d directory.
To add a program, make a new .conf
under the directory.
Example with Laravel Queueing
[program:laravel_queue]
command=php /usr/local/dev/beta.measure.iassessonline.com/artisan queue:listen
autostart=true
autorestart=true
stderr_logfile=/usr/local/dev/storage/beta/logs/laraqueue.err.log
stdout_logfile=/usr/local/dev/storage/beta/logslaraqueue.out.log
Note. laraqueue.err.log
& laraqueue.out.log
are needed to be created manually.
Do the following commands
sudo supervisorctl reread
sudo supervisorctl update
If something went wrong during the two previous command, e.g
$ sudo supervisorctl reread
error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 228
Try running
sudo supervisord -c /etc/supervisor/supervisord.conf
If something went wrong again, like
$ sudo supervisord -c /etc/supervisor/supervisord.conf
Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord.
For help, use /usr/bin/supervisord -h
Try to check for running ps -ef | grep supervisord
and kill the process. Then try running again.
sudo supervisord -c /etc/supervisor/supervisord.conf
Then lastly, this one
sudo supervisorctl -c /etc/supervisor/supervisord.conf
Hope it works. Find more in this tutorial link