python3启动
安装动态库
strings /lib64/libc.so.6 | grep ^GLIBC
ls -d /lib64/libc.so.6
https://pypi.org/project/setuptools/
# tar xzvf setuptools-18.3.2.tar.gz
# cd setuptools-18.3.2
# python setup.py install
https://pypi.org/project/meld3/
# tar zxvf meld3-1.0.2.tar.gz
# cd meld3-1.0.2
# python setup.py install
https://pypi.org/project/supervisor/
tar xf supervisor-4.2.2.tar.gz
yum install -y python-setuptools
cd supervisor-4.2.2
python setup.py install
echo_supervisord_conf > /etc/supervisord.conf
supervisord -c /etc/supervisord.conf
ps aux | grep supervisord
配置
cat > /etc/supervisord.conf << EOF
; Sample supervisor config file.
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
[inet_http_server]
port=0.0.0.0:9001
username=admin
password=123456
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[include]
files = supervisord.d/*.ini
files = /app/supervisord/supervisord.d/*.ini
EOF
mkdir -p /app/supervisord/{supervisord.d,logs}
mkdir /var/log/supervisor
mkdir /var/run/supervisor
chown -R app.app /var/run/supervisor
chown -R app.app /var/log/supervisor
chown -R app.app /app/supervisord/
supervisord -c /etc/supervisord.conf
配置开机自启动
cat > /etc/systemd/system/supervisord.service <<EOF
[Unit]
Description=Supervisor daemon
[Service]
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
ExecStop=/usr/bin/supervisorctl \$OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl \$OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
EOF
vim /etc/supervisord.conf
nodaemon=false ; 加入开机自启动后改成 true
systemctl start supervisord.service
systemctl restart supervisord.service
systemctl status supervisord.service