centos 8 supervisor 安装及配置案例
1、安装
yum install epel-release
yum install -y supervisor
[root@ip-172-31-31-207 ~]# yum install epel-release
Last metadata expiration check: 0:39:16 ago on Sun 26 Sep 2021 09:31:39 AM UTC.
Dependencies resolved.
===============================================================================================================
Package Architecture Version Repository Size
===============================================================================================================
Installing:
epel-release noarch 8-11.el8 extras 24 k
Transaction Summary
===============================================================================================================
Install 1 Package
Total download size: 24 k
Installed size: 35 k
Is this ok [y/N]: y
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-11.el8.noarch.rpm 1.3 MB/s | 24 kB 00:00
---------------------------------------------------------------------------------------------------------------
Total 49 kB/s | 24 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : epel-release-8-11.el8.noarch 1/1
Running scriptlet: epel-release-8-11.el8.noarch 1/1
Verifying : epel-release-8-11.el8.noarch 1/1
Installed:
epel-release-8-11.el8.noarch
Complete!
[root@ip-172-31-31-207 ~]# yum install superv*
Extra Packages for Enterprise Linux Modular 8 - x86_64 637 kB/s | 955 kB 00:01
Extra Packages for Enterprise Linux 8 - x86_64 11 MB/s | 10 MB 00:00
Last metadata expiration check: 0:00:02 ago on Sun 26 Sep 2021 10:11:20 AM UTC.
Dependencies resolved.
===============================================================================================================
Package Architecture Version Repository Size
===============================================================================================================
Installing:
supervisor noarch 4.2.2-1.el8 epel 576 k
Transaction Summary
===============================================================================================================
Install 1 Package
Total download size: 576 k
Installed size: 2.9 M
Is this ok [y/N]: y
Downloading Packages:
supervisor-4.2.2-1.el8.noarch.rpm 1.0 MB/s | 576 kB 00:00
---------------------------------------------------------------------------------------------------------------
Total 830 kB/s | 576 kB 00:00
warning: /var/cache/dnf/epel-6519ee669354a484/packages/supervisor-4.2.2-1.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
Extra Packages for Enterprise Linux 8 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x2F86D6A1:
Userid : "Fedora EPEL (8) <epel@fedoraproject.org>"
Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : supervisor-4.2.2-1.el8.noarch 1/1
Running scriptlet: supervisor-4.2.2-1.el8.noarch 1/1
Verifying : supervisor-4.2.2-1.el8.noarch 1/1
Installed:
supervisor-4.2.2-1.el8.noarch
Complete!
2、配置目录:/etc/supervisord.d/,配置test应用
配置test01案例:
[program:test01]
user=root
command=/opt/server/test/test01
directory=/opt/server/test/
stopsignal=TERM
autostart=false
autorestart=true
stdout_logfile=/opt/server/test/test01/log/test01-stdout.log
stderr_logfile=/opt/server/test/test01/log/test01-stderr.log
3、新增应用需要更新supervisor配置
supervisorctl update
4、启动test01
sudo supervisorctl start test01