sudo apt-get install supervisor
- For any new process create a supervisor config file
- path will be
/etc/supervisor/conf.d/myfile.conf
[program:diamond_process]
command=/root/project/folder/runner.sh
directory=/root/project/folder
autostart=yes
autorestart=yes
startretries=3
stderr_logfile=/var/log/project/diamond.err.log
stdout_logfile=/var/log/project/diamond.out.log
environment=ENV='prod',NAME='Diamond secret'
supervisorctl start all
supervisorctl status
- Make supervisor read newly created/update
.conf
files
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl reload
sudo supervisorctl stop all
sudo supervisorctl start diamond
sudo supervisorctl stop diamond
- Restart perticular process
sudo supervisorctl restart diamond
- Do not deamnize (--daemon) process in command. as supervisor already runs process in background