Mac 下 Supervisor 的安装与配置

1:   brew install python   

     sudopip installsupervisor

2:  在/etc下创建supervisord.conf

    并编辑内容如下: 

      [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/yuan/.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/yuan/shadowsocks

command = /usr/bin/python /Users/yuan/shadowsocks/local.py

autostart = true

autorestart = true

 

3:  启动 supervisor

     supervisord -c /etc/supervisord.conf

 

4: 把 supervisord 加入系统启动服务

   4.1:在/Library/LaunchDaemons 下创建com.agendaless.supervisord.plist文件,

    4.2:编辑内容如下: 

        <?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<a style="color: #00a9da; border-radius: 0px !important; border: 0px !important; float: none !important; height: auto !important; line-height: 1.1em !important; margin: 0px !important; overflow: visible !important; padding: 0px !important; width: auto !important; font-size: 1em !important; background-image: none !important;" href="http://www.apple.com/DTDs/PropertyList-1.0.dtd">http://www.apple.com/DTDs/PropertyList-1.0.dtd</a>">
<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>
4.3:启动supervisord服务: launchctl load ~/Library/LaunchAgents/dengjoe.supervisord.plist
 

 

 

 

  参考文章: https://medium.com/@canburak/daemons-for-a-developer-on-mac-os-d410b8390fac

                     http://dhq.me/mac-supervisor-install

                    https://nicksergeant.com/running-supervisor-on-os-x/

 

                      

 

 

相关推荐