Supervisor is a process monitoring program.
The meeting needs are: I now 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.
Get to know two commands first:
Supervisord:supervisor server-side section, starting supervisor is running this command
Supervisorctl: Start Supervisor Command-line window
installation (Centos):
[email protected] etc]# Yum install Python-setuptools
[Email protected] etc]# Easy_install Supervisor
To test whether the installation was successful :
[Email protected] etc]# echo_supervisord_conf
will show the following, in fact, a configuration template:
To Create a configuration file :
[Email protected] etc]# 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):
[include]
Files =/etc/supervisor/*.ini
Build Swoole-crontab.ini file under the/etc/supervisor/directory
[Program:swoole-crontab]
Command=php/alidata/www/didi365/crontab/main.php-d-S Start
Autorstart=true
Autorestart=true
Stdout_logfile=/tmp/supervisor.log
[Web Configuration]
[Inet_http_server]; inet (TCP) server disabled by default
port=*:9001; (Ip_address:port specifier, *:p ort for all iface)
; username=user; (Default is no username (open server))
;p assword=123; (Default is no password (open server))
If you configure a user name and password, you need to enter a user name and password to enter the Web interface
[Start Supervisord]
[Email protected] etc]# Supervisord
Might output a bunch of information.
/usr/lib/python2.6/site-packages/supervisor-3.1.3-py2.6.egg/supervisor/options.py:296:userwarning:supervisord is running as root and it are searching for its configuration file in default locations (including its current working dire Ctory); You probably want to specify a "-C" argument specifying an absolute path to a configuration file for improved security.
' Supervisord is running as root and it's searching '
/usr/lib/python2.6/site-packages/supervisor-3.1.3-py2.6.egg/supervisor/options.py:383:deprecationwarning: Parameters to load is deprecated. Call. Resolve and. require separately.
Return pkg_resources. Entrypoint.parse ("x=" +spec). Load (False)
Don't worry about it.
[Email protected] etc]# Ps-ef | grep Supervis
Root 9437 0 11:31 pts/0 00:00:00 grep supervis
Root 18836 1 0 10:02? 00:00:01/usr/bin/python/usr/bin/supervisord
[Command line administration Tools]
[Email protected] etc]# supervisorctl status
Swoole-crontab RUNNING pid 29981, uptime 0:33:05
If you modify/etc/supervisord.conf, you need to perform supervisorctl reload to reload the configuration file
Error:another program was already listening on a port the one of our HTTP servers are configured to use. Shut This program down first before starting
Workaround:
Find/-name Supervisor.sock
Unlink/name/supervisor.sock
Supervisor Installation and Configuration