Skip to content

Instantly share code, notes, and snippets.

@labianchin
Last active January 16, 2025 19:31
Show Gist options
  • Save labianchin/de7e7b7178d1d5f68967 to your computer and use it in GitHub Desktop.
Save labianchin/de7e7b7178d1d5f68967 to your computer and use it in GitHub Desktop.
How to use supervisord in centos/fedora/red hat like systems

Supervisord

Configure and install supervisord

https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps http://supervisord.org/configuration.html https://github.com/strongloop/node-foreman

easy_install supervisor
echo_supervisord_conf > /etc/supervisord.conf
supervisord -c /etc/supervisord.conf

echo -e "\n[include]\nfiles = /etc/supervisor/conf.d/*" > /etc/supervisord.conf
mkdir -p /etc/supervisor/conf.d/

supervisorctl reload
supervisorctl reread

Add suppervisord init script, to start on boot:

curl https://raw.githubusercontent.com/Supervisor/initscripts/master/redhat-init-mingalevme > /etc/rc.d/init.d/supervisord
chmod 755 /etc/rc.d/init.d/supervisord
chkconfig --add supervisord
chkconfig --list supervisord
chkconfig supervisord on
service supervisord start

I also had to add this to the init script: . /etc/bashrc.

Use this to manage the init service:

service supervisord stop
service supervisord status
service supervisord restart

supervisorctl start 'cors:*'

supervisorctl update Restarts apps whose configurations has changed. http://www.onurguzel.com/supervisord-restarting-and-reloading/

@jppcel
Copy link

jppcel commented Jan 16, 2025

For this line

echo -e "\n[include]\nfiles = /etc/supervisor/conf.d/*" > /etc/supervisord.conf

Using > in echo not only includes what required into file, before this the command empty the file and after do the insert.
I suggest to change this line to

echo -e "\n[include]\nfiles = /etc/supervisor/conf.d/*" >> /etc/supervisord.conf

that only put this at the final lines of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment