[https://segmentfault.com/a/1190000003040086](https://segmentfault.com/a/1190000003040086)
[https://blog.csdn.net/baidu\_15113429/article/details/84749624](https://blog.csdn.net/baidu_15113429/article/details/84749624)
錯誤解決方案:[https://my.oschina.net/michao/blog/738593](https://my.oschina.net/michao/blog/738593)
supervisord : supervisor的服務器端部分,用于supervisor啟動
supervisorctl:啟動supervisor的命令行窗口,在該命令行中可執行start、stop、status、reload等操作。
重啟service?supervisord restart
或者重新載入?service?supervisord reload
查看進程 pstree
### /etc/supervisor/queue_MultiTask.conf
```
[program:queue_MultiTask] ;項目名稱
directory = /www/wwwroot/www.site.net ; 程序的啟動目錄
command = php think queue:listen --queue MultiTask --tries 3 ; 啟動命令
process_name=%(program_name)s_%(process_num)02d
numprocs = 3 ; 開啟的進程數量
autostart = true ; 在 supervisord 啟動的時候也自動啟動
startsecs = 5 ; 啟動 5 秒后沒有異常退出,就當作已經正常啟動了
autorestart = true ; 程序異常退出后自動重啟
startretries = 3 ; 啟動失敗自動重試次數,默認是 3
user = www ; 用哪個用戶啟動
redirect_stderr = true ; 把 stderr 重定向到 stdout,默認 false
stdout_logfile_maxbytes = 50MB ; stdout 日志文件大小,默認 50MB
stdout_logfile_backups = 20 ; stdout 日志文件備份數
; stdout 日志文件,需要手動創建目錄(supervisord 會自動創建日志文件)
stdout_logfile = /www/wwwroot/www.site.net/queue_MultiTask.log
loglevel=info
```

supervisor守護跑php腳本后臺長期運行
[https://blog.csdn.net/lmjy102/article/details/81223346](https://blog.csdn.net/lmjy102/article/details/81223346)
thinkphp隊列+supervisor實踐
[https://blog.csdn.net/idkuangxiao/article/details/82765107](https://blog.csdn.net/idkuangxiao/article/details/82765107)
開機啟動
[https://www.cnblogs.com/sundahua/p/9149692.html](https://www.cnblogs.com/sundahua/p/9149692.html)
Supervisord 開機啟動
為了處理機器宕機重啟的情況,Redis 服務進程需要實現機器重啟后自動重啟的功能。 為此,需要配置 supervisord 進程隨著機器啟動而啟動。要實現這一目的 ,可以在 /etc/init 目錄下添加 supervisord.conf 文件:
description "supervisord"
start on runlevel \[2345\]
stop on runlevel \[!2345\]
respawn
exec supervisord -n -c /etc/supervisor/supervisord.conf
\---------------------
作者:haozlee
來源:CSDN
原文:https://blog.csdn.net/lihao21/article/details/77689790
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!
[Supervisor 安裝與配置](https://segmentfault.com/a/1190000003040086)
* [supervisor](https://segmentfault.com/t/supervisor/blogs)
?13.2k 次閱讀 ?·? 讀完需要 10 分鐘
0
[Supervisor]
http://supervisord.org/
\[Python\]
如果沒有,自己去裝吧,一般 linux 自帶了.
\[easy\_install\]
\[root@vm source\]# wget https://bootstrap.pypa.io/ez\_setup.py -O - | python
\[安裝superviosr\]
\[root@vm source\]\# easy\_install supervisor
\[狀態\]
\[root@vm source\]\# python Python 2.6.6 (r266:84292, Jan 22 2014, 09:37:14) \[GCC 4.4.7 20120313 (Red Hat 4.4.7\-4)\] on linux2 Type "help", "copyright", "credits" or "license" for more information. \>>\> import supervisor \>>\>
\[配置文件\]
\[root@vm source\]# echo\_supervisord\_conf > /etc/supervisord.conf
\[監視一個程序\]
; The \[include\] section can just contain the "files" setting. This ; setting can list multiple files (separated by whitespace or ; newlines). It can also contain wildcards. The filenames are ; interpreted as relative to this file. Included files \*cannot\* ; include files themselves. \[include\] /\*\*我是注釋,一定要把前面的分號;去掉,不然不會開啟include功能,太傻了\*\*/ files = /etc/supervisor/\*.ini
在?/etc/supervisor/?目錄下建立?redis.ini?文件
\[program:redis\] command=/usr/bin/redis-server /usr/local/redis/redis.conf autorstart=true autorestart=true stdout\_logfile=/tmp/supervisor.log
\[Web配置\]
\[inet\_http\_server\] ; inet (TCP) server disabled by default port=\*:9001 ; (ip\_address:port specifier, \*:port for all iface) ;username=user ; (default is no username (open server)) ;password=123 ; (default is no password (open server))
如果配置了用戶名和密碼,就需要輸入用戶名和密碼才能進入web界面。
\[啟動supervisord\]
\[root@vm source\]\# supervisord 可能會輸出一堆信息出來 /usr/lib/python2.6/site-packages/supervisor\-3.1.3\-py2.6.egg/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 'Supervisord is running as root and it is searching ' /usr/lib/python2.6/site-packages/supervisor\-3.1.3\-py2.6.egg/supervisor/options.py:383: DeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately. return pkg\_resources.EntryPoint.parse("x="+spec).load(False)
不用管它
\[root@vm source\]\# ps -ef |grep supervisord root 20041 1 0 03:21 ? 00:00:00 /usr/bin/python /usr/bin/supervisord \[root@vm source\]\# ps -ef| grep redis root 20074 20073 0 03:23 ? 00:00:00 /usr/bin/redis-server \*:6379
有上述進程,就表明成功了。
\[WEB管理界面\]

\[命令行管理工具\]
\[root@vm source\]# supervisorctl status redis RUNNING pid 20074, uptime 0:13:25
錯誤解決方案:[https://my.oschina.net/michao/blog/738593](https://my.oschina.net/michao/blog/738593)
mac supervisor error :Another program is already listening on a port that one of our HTTP servers is?

* 錯誤 Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord. For help, use /usr/local/bin/supervisord -h
* 解決方案
* 好像是supervisor已經在運行了,現在要再啟動就得把之前的kill掉
$ ps -ef | grep supervisord 0 5622 1 0 2:33上午 ?? 0:00.84 /usr/bin/python /usr/local/Cellar/supervisor/3.2.1/libexec/bin/supervisord -c /etc/supervisor/supervisord.conf 501 7459 5853 0 3:26上午 ttys003 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn supervisord $ sudo kill -9 5622 $ supervisord
就OK了
* 錯誤 Unlinking stale socket /tmp/supervisor.sock \*解決方案
$ sudo unlink /tmp/supervisor.sock $ ps -ef | grep supervisord $ sudo kill -9 5622 $ supervisord
- PHP新特性
- 一些常識
- PHP常見header頭
- Nginx配置文件
- 常用工具類
- PHP實現的一個時間幫助類
- PHP原生生成EXCEL
- PHP地理位置計算
- PHP獲取服務器狀態
- 駝峰轉下劃線
- 百度地圖兩點坐標距離計算
- 判斷是否是url
- 郵件發送類
- 阿拉伯數字轉化為大寫
- 獲取漢字首個拼音
- 根據身份證號獲取星座
- 生成驗證碼類
- 生成唯一ID
- 身份證驗證類
- PHP中文轉拼音
- curl獲取網頁內容
- 快遞查詢api
- 快遞API類
- 上傳圖片類
- 股票類
- 找回密碼類
- 校驗數據規則
- PHP獲取收集相關信息
- 字符串截取助手函數
- 網頁中提取關鍵字
- 檢測瀏覽器語言
- PHP實現微信紅包拆分算法
- 常用函數
- 微信相關
- 網絡知識
- LX1 Laravel / PHP 擴展包視頻教程
- THINKPHP5學習
- 高級查詢
- Vue學習
- Vue全家桶
- Vue-CLI 3.x 自動部署項目至服務器
- Vue2全家桶
- Vue2全家桶之一:vue-cli(vue腳手架)超詳細教程
- Vue2全家桶之二:vue-router(路由)詳細教程,看這個就夠了
- Vue2全家桶之三:vue-resource(不推薦)----axios(推薦)
- 前端相關
- sublime text3 配置less編譯環境
- 服務器搭建相關
- supervisor
- Supervisor 安裝與配置 Linux進程管理
- supervisor 永不掛掉的進程 安裝以及使用
- Supervisor進程管理&開機自啟
- php實現定時任務
- 使用sublime text3 連接sftp/ftp(遠程服務器)
- Redis相關
- linux服務器重啟后導致redis數據丟失
- 搜索引擎SEO
- 百度收錄權威鏈接,指向真正需要收錄的地址rel
- 軟件相關
- sublime
- sublime Text3修改側邊欄的主題
- sublime和vscode比較
- Acrylic DNS Proxy 使用方法
- 技術類網址收藏