欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Mac下Supervisor進(jìn)程監(jiān)控管理工具的安裝與配置

 更新時間:2014年12月16日 10:35:50   投稿:junjie  
這篇文章主要介紹了Mac下Supervisor進(jìn)程監(jiān)控管理工具的安裝與配置,Supervisor 是由 Python 寫成,是一個類 unix 操作系統(tǒng)下的進(jìn)程監(jiān)控管理工具,本文講解MAC系統(tǒng)下的配置與安裝,需要的朋友可以參考下

Supervisor 是一個類 unix 操作系統(tǒng)下的進(jìn)程監(jiān)控管理工具。

安裝 Supervisor

Supervisor 是由 Python 寫成,可用 Python 的包安裝管理工具 pip(Python Package Index) 直接安裝:

復(fù)制代碼 代碼如下:

sudo pip install supervisor

配置 Supervisor

Supervisor 的配置文件命名為 supervisord.conf,它為 supervisord(Supervisor 的主服務(wù)命令) 和 supervisorctl(Supervisor 的監(jiān)控管理命令) 提供配置選項設(shè)置。 Supervisor 并不規(guī)定配置文件 supervisord.conf 的存放位置,Supervisor 服務(wù)啟動的時候默認(rèn)會在:

復(fù)制代碼 代碼如下:

$CWD/supervisord.conf
$CWD/etc/supervisord.conf
/etc/supervisord.conf

這幾個目錄位置查找配置文件 supervisord.conf。Supervisor 也提供參數(shù) "-c" 來指定配置文件的目錄路徑。

在終端輸入 "echo_supervisord_conf" 命令可查看 Supervisor 的默認(rèn)配置的內(nèi)容。

生成一份默認(rèn)的配置文件:

復(fù)制代碼 代碼如下:

echo_supervisord_conf > /etc/supervisord.conf

這里有選擇的設(shè)置了一些配置,基本夠用,配置如下:

復(fù)制代碼 代碼如下:

[inet_http_server]
port = 127.0.0.1:9001
username = dhq
password = 123456
 
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0700
 
[supervisord]
logfile = /Users/dengjoe/.supervisor/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = False
minfds = 1024
minprocs = 200
umask = 022
identifier = supervisor
directory = /tmp
nocleanup = true
childlogdir = /tmp
 
[supervisorctl]
serverurl = unix:///tmp/supervisor.sock
 
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
 
 
 
[program:shadowsocks]
directory = /Users/dengjoe/shadowsocks
command = /usr/bin/python /Users/dengjoe/shadowsocks/local.py
autostart = true
autorestart = true

啟動 Supervisor

復(fù)制代碼 代碼如下:

supervisord -c /etc/supervisord.conf

參數(shù) "-c" 表示指定 Supervisor 配置文件的路徑

把 supervisord 加入系統(tǒng)啟動服務(wù)

復(fù)制代碼 代碼如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>KeepAlive</key>
    <dict>
        <key>SuccessfulExit</key>
        <false/>
    </dict>
    <key>Label</key>
    <string>dengjoe.supervisord</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/supervisord</string>
        <string>-n</string>
        <string>-c</string>
        <string>/etc/supervisord.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

啟動 Supervisor 服務(wù):

復(fù)制代碼 代碼如下:

launchctl load ~/Library/LaunchAgents/dengjoe.supervisord.plist

supervisorctl 監(jiān)控命令

supervisorctl 是 Supervisor 自帶的后臺進(jìn)程控制工具,下面是該命令的一些用法:

啟動應(yīng)用:

復(fù)制代碼 代碼如下:

supervisorctl start program

重新讀取配置:

復(fù)制代碼 代碼如下:

supervisorctl update

相關(guān)文章

最新評論