新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Linux中安裝supervisor具體步驟
Supervisor是用Python開發(fā)的一套通用的進程管理程序,能將一個普通的命令行進程變?yōu)楹笈_daemon,并監(jiān)控進程狀態(tài),異常退出時能自動重啟,下面為大家分享一下在Linux中安裝 supervisor 具體步驟。

創(chuàng)新互聯(lián)公司長期為成百上千家客戶提供的網(wǎng)站建設服務,團隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務;打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為細河企業(yè)提供專業(yè)的網(wǎng)站設計、網(wǎng)站建設,細河網(wǎng)站改版等技術(shù)服務。擁有10余年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。
1,安裝python,supervisor
# apt-get install python supervisor
2,配置supervisor
# cat /etc/supervisor/conf.d/mini_breakpad.conf
[program:minibreakpad] //進程名稱
directory = /root/error/mini-breakpad-server //程序的啟動目錄
command = node lib/app.js //啟動命令
autostart = true //在supervisord 啟動的時候也自動啟動
startsecs = 5 //啟動5秒后沒有退出就當做已經(jīng)正常啟動
autorestart = true //程序異常退出后自動重啟
startretries = 5 //啟動失敗自動重試次數(shù) 5
user = root //用哪個用戶啟動
redirect_stderr = true //把 stderr 重定向到 stdout 默認 false,如果是false就不需要設置下面的log配置
stdout_logfile_maxbytes = 20MB //stdout 日志文件大小,默認50MB
stdout_logfile_backups = 20 //stdout 日志文件備份數(shù)
//stdout 日志文件,需要注意當指定目錄不存在時無法正常啟動,所以需要手動創(chuàng)建目錄(supervisord 會自動創(chuàng)建日志文件)
stdout_logfile = /root/error/mini-breakpad-server/logs/stdout.log
3,重啟supervisor,查看狀態(tài)
# /etc/init.d/supervisor restart
# supervisorctl status
minibreakpad RUNNING pid 17655, uptime 2:57:07
注意:如果在后臺運行的程序,有守護進程的,就不要用supervisor,用了nohup也不行。會報以下錯誤
# supervisorctl status
minibreakpad FATAL Exited too quickly (process log may have details)
分享文章:Linux中安裝supervisor具體步驟
本文地址:http://fisionsoft.com.cn/article/ccehjpj.html


咨詢
建站咨詢
