supervisor是linux下的一個(gè)進(jìn)程監(jiān)控軟件,是使用python寫的。
安裝
supervisor下載
最新版本,然后解壓并進(jìn)入該目錄,運(yùn)行
python setup.py install
安裝成功后會(huì)在 /usr/local/bin 目錄下生成echo_supervisord_conf,supervisorctl,supervisord等相關(guān)可執(zhí)行文件。
echo_supervisord_conf > /etc/supervisor/supervisord.conf
這樣會(huì)生成一個(gè)supervisor的主要配置文件。
supervisor的一些相關(guān)信息
運(yùn)行
supervisord -c /etc/supervisor/supervisord.conf
配置
[program:weixin] #程序的名字,在supervisor中可以用這個(gè)名字來管理該程序。
command=python /data/wechat/start.py #啟動(dòng)程序的命令
startsecs=0 #重新啟動(dòng)時(shí),等待的時(shí)間
stopwaitsecs=0 #停止程序時(shí)等待的時(shí)間
autostart=true #設(shè)置自動(dòng)啟動(dòng), 隨supervisor的啟動(dòng)而啟動(dòng)
autorestart=true #重新啟動(dòng), 程序停止之后是否需要重新將其啟動(dòng)
stderr_logfile=/data/logs/weixin.err #程序錯(cuò)誤信息重定向到該文件