Installation and operation of Supervisor



1、 Install supervisor installation

Note: all of the following operations are performed in centos7

1. Install centos7 extended software warehouse

sudo yum install -y epel-release

2. Install Supervisor

yum install -y supervisor

3. View the installation path

rpm -ql supervisor

4. Modify and define INI file


Find the file of the supervisor’s configuration. For example:whereis supervisord.ini perhapsfind / -name supervisor* Command to query


Modify the configuration file, and modify the INI file path in the last line of the configuration file, which means that the supervisor will load the
All suffixes areiniDocuments.

Installation and operation of Supervisor
Installation and operation of Supervisor


EstablishiniFile, join in the process management of supervisor, and realize the background operation of server
		#Example is the name of the process in the supervisor, whatever you choose
		command=/usr/local/bin/gunicorn -w 4 -b run:app 
		#The above code is to run flash with gunicorn. Run is your filename: app means app = flask (\\\\\\\\\
		command=/usr/local/bin/python3 /root/test/
		#Command = file to be run in the path where the instruction is running (PS: absolute path is recommended)

		#Absolute path of the file to run
Python running single file configuration example

In fact, if you only run a single file, you can directly usenohup python &(PS: needcdreachtestExecute this command in the folder) to run the server in the background, and at the same timetest.pyGenerated under the foldernohup.outlog file

		command=python /home/myname/
An example of the configuration file of running flash by gunicore
		command=/usr/local/bin/gunicorn -w 4 -b flask:app

2、 Start Supervisor

		#Start supervisor and specify the conf file path
		Absolute path of Supervisor - C configuration file
		e.g: supervisord -c /etc/supervisor/supervisord.conf  

		#Close Supervisor
supervisorctl shutdown

1. Start the supervisor service

supervisorctl start all    
		#Turn on all
		supervisorctl status 
#View supervisor service status

2. After modifying the supervisor INI file or conf file configuration, the service needs to be updated

supervisorctl update 
		#Update the configuration of Supervisor
		supervisorctl reload 
#Reload project into memory

3. Restart the supervisor service

supervisorctl restart
#Whether it is currently closed or running

4. Log path

tail -f /var/log/supervisor/supervisord.log

5. Close the service of Supervisor

supervisorctl stop all 
		#Close all
		supervisorctl stop example 
		#Turn off one of them

3、 About reporting errors

Basically, I have reported all the errors, but they are classified into three categories:

  1. Supervisor is not started —– > Run Supervisor command
  2. There is an error in your profile content ——– check your profile content
  3. There is an error in the code you need to run —– > check your code:

4、 Reading feedback

If you have any help, you can like it. If you think it’s not detailed enough, you can comment and point out.

Thank you for reading.

Recommended Today

Im instant messaging system implemented by gochat pure go A kind of

Project recommendation A kind of Project address:… Category: Go Project Description: Gochat is an instant messaging system implemented by go only, which supports private message and room broadcast message. Each layer communicates through RPC and supports horizontal expansion. Using redis as the carrier of message storage and delivery is more convenient and efficient than […]