supervisor是
python
寫的進(jìn)程管理工具
安裝
因?yàn)槭?code>python寫的,所以可以用pip
安裝。
sudo apt-get install supervisor
pip install supervisor
結(jié)構(gòu)
服務(wù)器端
- 服務(wù)端配置文件默認(rèn)位置
sudo vim /etc/supervisor/supervisord.conf
- 導(dǎo)出配置文件
echo_supervisord_conf > /etc/supervisor/supervisord.conf
- 啟動(dòng)命令
supervisord -c /etc/supervisor/supervisord.conf
客戶端
- 命令行客戶端
supervisorctl
需要在配置文件中添加
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700
- web客戶端
需要在配置文件中添加
[inet_http_server]
port=*:30040
username=admin
password=admin
自動(dòng)啟動(dòng)
在/etc/rc.local
中增加一行
service supervisor start
配置文件
監(jiān)控對(duì)象服務(wù)的配置文件
默認(rèn)位置存放于/etc/supervisor/conf.d/*.conf
。建議將程序的配置文件放置到各自項(xiàng)目文件夾下某筐,然后將配置文件用硬鏈接
放到默認(rèn)文件夾下武学。默認(rèn)日志文件
tail -f /var/log/supervisord.log
- Supervisor重新加載配置啟動(dòng)新的進(jìn)程
參考文章