supervisor 服务 利用python脚本安装 (20200914)
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