From a3a5d48dbe0e82a7b9b0836c3678230c8be457bd Mon Sep 17 00:00:00 2001 From: ilvsx Date: Mon, 23 Jun 2014 03:53:25 -0700 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=86=99wiki?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E7=9F=A5=E9=81=93=E8=BF=99=E6=A0=B7=E5=86=99?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=A6=A5=E5=BD=93=EF=BC=8C=E8=AF=B7=E5=A4=9A?= =?UTF-8?q?=E5=A4=9A=E6=8C=87=E6=95=99=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 用-Supervisor-运行-Shadowsocks.md | 58 ++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/用-Supervisor-运行-Shadowsocks.md b/用-Supervisor-运行-Shadowsocks.md index 703846f..8d2f407 100644 --- a/用-Supervisor-运行-Shadowsocks.md +++ b/用-Supervisor-运行-Shadowsocks.md @@ -1,6 +1,62 @@ 如果你想在后台运行 Shadowsocks,可以使用 supervisor。 -以 Debian 7.0 为例: +Supervisor是一个C/S系统,它可以在类UNIX系统上控制系统进程,由python编写,它提供了大量的功能来实现对进程的管理。 + +###安装 +- pip + + pip install supervisor + +- easy_install + + easy_install supervisor + +- apt-get (Debian/Ubuntu) + + apt-get update + apt-get install supervisor + #默认配置文件在`/etc/supervisor/supervisord.conf` + +- yum (Centos) + + yum install supervisor + +###创建配置文件 + +安装完成后,使用下面两种方式之一创建默认配置文件: +- 默认路径(`apt-get`方式在`/etc/supervisor/supervisord.conf`) + + echo_supervisord_conf > /etc/supervisord.conf + #supervisord程序在运行后会自动查找并加载此目录配置文件。 + +- 指定路径 + + echo_supervisord_conf > "指定路径"/supervisord.conf + #supervisord程序使用-c参数在启动时手动指定配置文件:`supervisord -c "指定路径"/supervisord.conf`。 + +###添加shadowsocks +编辑配置文件supervisord.conf,在后面添加 + + [program:shadowsocks] + command=ssserver -c /etc/shadowsocks.json + autostart=true + autorestart=true + user=nobody +###启动 + +- 默认路径配置启动:`supervisord` + +- 指定路径配置启动:`supervisord -c "指定路径"/supervisord.conf` + +###常用命令 + +- 获得所有程序状态 `supervisorctl status` +- 关闭目标程序 `supervisorctl stop ssserver` +- 启动目标程序 `supervisorctl start ssserver` +- 关闭所有程序 `supervisorctl shutdown` + +--- +###以 Debian 7.0 为例 执行 ```