Skip to content

Instantly share code, notes, and snippets.

@shivampip
Last active December 30, 2020 17:46
Show Gist options
  • Save shivampip/849d3c2ad6ba99d94bbfc8dbc49a1f0e to your computer and use it in GitHub Desktop.
Save shivampip/849d3c2ad6ba99d94bbfc8dbc49a1f0e to your computer and use it in GitHub Desktop.
Supervisord Cheetsheet

Supervisord

Installation

sudo apt-get install supervisor

Configuration file

  • 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'

Process Control

  • Start supervisor
supervisorctl start all
  • Check status
supervisorctl status
  • Make supervisor read newly created/update .conf files
sudo supervisorctl reread
sudo supervisorctl update
  • Restart it
sudo supervisorctl reload
  • Stop all
sudo supervisorctl stop all

Control single process

  • Start perticular process
sudo supervisorctl start diamond
  • Stop perticular process
sudo supervisorctl stop diamond
  • Restart perticular process
sudo supervisorctl restart diamond

Note

  • Do not deamnize (--daemon) process in command. as supervisor already runs process in background
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment