Installing supervisord on Centos 7.X

Publish: 2017-08-13 | Modify: 2018-09-28

supervisord is a process management tool for Linux/Unix systems.

Installation

yum install supervisor

Setting up auto-start

systemctl enable supervisord.service

Configuration file

The configuration file for supervisord is located at /etc/supervisord.conf. Custom configuration files with .ini extension can be placed in the directory /etc/supervisord.d.

supervisord commands

Start:

systemctl start supervisord.service

Stop:

systemctl stop supervisord.service

Restart:

systemctl restart supervisord.service

Process configuration

For example, to configure an nginx process, create a file /etc/supervisord.d/nginx.ini with the following content:

[program:nginx]
command = /www/lanmps/bin/nginx start
autostart = true
startsecs = 5
autorestart = true
startretries = 3
user = www
redirect_stderr = true
stdout_logfile_maxbytes = 20MB
stdout_logfile_backups = 20
stdout_logfile = /www/logs/usercenter_stdout.log
stopasgroup = false
killasgroup = false

supervisord client management commands

Check status:

supervisorctl status

Stop nginx:

supervisorctl stop nginx

Start nginx:

supervisorctl start nginx

Restart nginx:

supervisorctl restart nginx

Reread the configuration:

supervisorctl reread

Update with new configuration:

supervisorctl update

Other

Components

  • supervisord: service daemon
  • supervisorctl: command-line client
  • Web Server: provides a web-based interface similar to supervisorctl
  • XML-RPC Interface: XML-RPC interface

Configuration file

The configuration file /etc/supervisord.conf contains the following sections:

[unix_http_server]
file=/tmp/supervisor.sock

[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[program:xx]
command=/opt/apache-tomcat-8.0.35/bin/catalina.sh run
autostart=true
startsecs=10
autorestart=true
startretries=3
user=tomcat
priority=999
redirect_stderr=true
stdout_logfile_maxbytes=20MB
stdout_logfile_backups=20
stdout_logfile=/opt/apache-tomcat-8.0.35/logs/catalina.out

[include]
files=/etc/supervisord.d/*.ini

References:


Comments