supervisor是把普通app变成deamon的工具,虽然没有erlang的supervise粒度那么细,但是已经非常方便了
安装
sudo apt-get install supervisor
修改配置文件
sudo gvim /etc/supervisor/supervisord.conf
添加下面的以支持web管理
[inet_http_server]
port=
username=admin
password=admin
新建单独的配置
sudo gvim /etc/supervisor/conf.d/shadowsocks.conf
[program:shadowsocks]
command=/home/mmc/tools/shadowsocks/shadowsocks-local-linux64 -c="/home/mmc/tools/shadowsocks/config.json"
autorestart=true
stdout_logfile=/home/mmc/tools/shadowsocks/supervisor.log
supervisor的命令
sudo invoke-rc.d supervisor start
sudo supervisorctl status shadowsocks
如果启动的时候报错
* Starting Supervisor daemon manager...
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/bin/supervisord -h
...fail!
解决办法
sudo find / -name supervisor.sock
sudo unlink /***/supervisor.sock