Supervisor is a process management tool, the official saying:
The purpose is to have a process that needs to run all the time, but this process can be interrupted for a variety of reasons. I want to be able to restart it automatically when the process is interrupted, and I need to use the supervisor
There are two main commands:
- Supervisord : Supervisor Server-side section, starting supervisor is running this command
- Supervisorctl: Launches the command-line window for supervisor.
Installation (CentOS):
Way One:
Yum-y Install Python-setuptoolseasy_install Supervisor
Way two:
If the easy_install is not good, download it from the official:
wget https://pypi.python.org/packages/source/s/supervisor/supervisor-3.1.3.tar.gz
Then install it through Python:
Tar zxf supervisor-3.1.3.tar.gzcd supervisorpython setup.py Install
After a successful installation, you can log in to the Python console and enter import supervisor to see if it will load successfully.
Build configuration file (supervisord.conf):
echo_supervisord_conf >/etc/supervisord.conf
To modify a configuration file:
The last increment in supervisord.conf (the expression comment behind the semicolon, can not be written):
[program:bandwidth]command=python26/usr/local/bin/bandwidth.sh; command to be executed WD] User=root;(d Efault is the current user, Required if root) autostart=true; start at supervisord start (default:true) autorestart=true, whether/when to restart (de fault:unexpected) startsecs=3; number of secs prog must stay running (def. 1) stderr_logfile=/tmp/bandwidth_err.log; redi RECT proc stderr to stdout (default false) Error output redirect Stdout_logfile=/tmp/bandwidth.log; stdout log path, none for none; Default AUTO, log output
(For more configuration instructions please refer to: http://supervisord.org/configuration.html)
To run the command:
Start Supervisor
Supervisord-c/etc/supervisord.conf
Open command Line
[Email protected] bin]# supervisorctl status bandwidth RUNNING pid 2423, uptime 0:06:35 [[EMA Il protected] bin]# supervisorctl Help default commands (Type help <topic>): ================================= = = = Add Clear FG Open quit remove restart start stop update avail exit Maintail PID Reloa D Reread shutdown status tail version
CTL: Help//view command
In CTL: status//view state
Special attention:
If you modify the /etc/supervisord.conf, you need to perform supervisorctl reload to reload the configuration file, otherwise it will not take effect ...
Installation and Getting Started tutorials for Linux process management tool Supervisord