Installation and configuration file of supervisor under Linux

Time:2021-6-11

Supervisor is a process monitor in Linux operating system. It can restart automatically when a program fails.

Supervisor is applicable to almost all platforms except windows, including Linux, Mac OS X, Solaris and FreeBSD. It’s written entirely in Python, so you don’t need a C compiler to install it.

install

Install via PIP:

pip install supervisor

#Print the supervisor configuration file to the standard output of the terminal
echo_supervisord_conf

#Save profile
echo_supervisord_conf > /etc/supervisord.conf

Or use the following command to install supervisor on Ubuntu:

sudo apt-get install supervisor

configuration file

The supervisor configuration file is usually named supervisor. Conf. have access to-cOption to explicitly specify the configuration file location. Otherwise, the supervisor looks for the file named supervisor.conf in order from the following location and uses it.

  1. ../etc/supervisord.conf
  2. ../supervisord.conf
  3. $CWD/supervisord.conf
  4. $CWD/etc/supervisord.conf
  5. /etc/supervisord.conf
  6. /etc/supervisor/supervisord.conf
environment variable

Supervisor use%(ENV_X)sExpression to reference an environment variable. For example:

[program:example]
command=/usr/bin/example --loglevel=%(ENV_LOGLEVEL)s

expression%(ENV_LOGLEVEL)sThe corresponding environment variables are:LOGLEVEL