supervisor 服務 利用python指令碼安裝 (20200914)
阿新 • • 發佈:2020-09-14
1.下載包
wget https://pypi.python.org/packages/source/s/supervisor/supervisor-3.1.3.tar.gz
2.解壓
tar zxvf supervisor-3.1.3.tar.gz
3.安裝
cd supervisor-3.1.3 python setup.py install
4.建立檔案
mkdir -p /etc/supervisord.d/ touch /etc/supervisord.conf touch /usr/lib/systemd/system/supervisord.service
5.寫入檔案內容(supervisor配置)至建立的檔案
cat >> /etc/supervisord.conf << EOF [unix_http_server] file=/var/run/supervisor.sock ; the path to the socket file [supervisord] logfile=/var/log/supervisord.log ; main log file; default $CWD/supervisord.log logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB logfile_backups=10 ; # of main logfile backups; 0 means none, 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=1024000 ; 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 = /etc/supervisord.d/*.ini EOF
cat >> /usr/lib/systemd/system/supervisord.service << EOF [Unit] Description=supervisord - Supervisor process control system for UNIX Documentation=http://supervisord.org After=network.target [Service] LimitNPROC=65535 LimitNOFILE=65535 Type=forking ExecStart=/bin/supervisord -c /etc/supervisord.conf ExecReload=/bin/supervisorctl reload ExecStop=/bin/supervisorctl shutdown User=root [Install] WantedBy=multi-user.target EOF
6.啟動
systemctl daemon-reload systemctl start supervisord.service supervisorctl status systemctl stop supervisord.service