Supervisor常用命令
**安裝:**
1. yum install python-setuptools
2. easy_install supervisor
**安裝成功后 生成配置文件:**
1. echo_supervisord_conf > /etc/supervisord.conf
**添加自己的配置文件:**
我也學(xué)網(wǎng)上在/etc/下面新建一個(gè)專門放 .conf 的文件夾,感覺這樣很好,比一味修改supervisord.conf文件要更方便以后管理
我這命名
"supervisord_conf"
在supervisord_conf中新建個(gè).conf文件
我的
demo.conf
**配置文件(目錄/etc/supervisord_conf)**
[program:demo]
user=root
command=/root/Applications/Go/bin/demo
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/root/Applications/LogFile/log/demo.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/root/Applications/LogFile/err/demo.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
stopsignal=INT
[supervisord]
**說明:**
command:表示運(yùn)行的命令,我這是填寫的我demo安裝包的原則路徑。
autostart:表示是否跟隨supervisor一起啟動(dòng)。
autorestart:如果該程序掛了,是否重新啟動(dòng)。
stdout_logfile:終端標(biāo)準(zhǔn)輸出重定向文件。
stderr_logfile:終端錯(cuò)誤輸出重定向文件。
==注意上面的兩個(gè)log文件:==
/root/Applications/LogFile/log/demo.log
/root/Applications/LogFile/err/demo.log
都要在相應(yīng)目錄下面創(chuàng)建對(duì)應(yīng)的log
**修改配置文件:**
1. 編輯/etc/supervisord.conf
2. 在文件最下面 剛打開是這樣的
;[include]
;files = relative/directory/*.ini
3. 改成這樣
[include]
files = /etc/supervisord_conf/*.conf
'注意:'[include]前面的';'要去掉,我在這點(diǎn)上耽誤了點(diǎn)時(shí)間
1. 啟動(dòng)
/usr/bin/supervisord -c /etc/supervisord.conf
2. 查看狀態(tài)
supervisorctl status
3. 更新新的配置到supervisord
supervisorctl update
4. 重啟
supervisorctl reload
5. 殺死進(jìn)程
ps ax | grep supervisor
find / -name supervisor.sock
unlink /tmp/supervisor.sock
6. 啟動(dòng)某個(gè)進(jìn)程(program_name=你配置中寫的程序名稱)
supervisorctl start program_name
7. 查看正在守候的進(jìn)程
supervisorctl
8. 停止某一進(jìn)程 (program_name=你配置中寫的程序名稱)
supervisorctl stop program_name
9. 重啟某一進(jìn)程 (program_name=你配置中寫的程序名稱)
supervisorctl restart program_name
10. 停止全部進(jìn)程
supervisorctl stop all
11. 解決 unix:///tmp/supervisor.sock no such file
http://www.cashqian.net/blog/001472975510127673ea63db9234c4e8293cf43cefcafde000
https://blog.csdn.net/qq_28885149/article/details/79364685
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。