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" "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>
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/

 

                      

 

 

猜你喜欢

转载自hongtoushizi.iteye.com/blog/2227149