forked from samzong/gfwlist2privoxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssr
66 lines (57 loc) · 2.18 KB
/
ssr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# 作者:老徐
# SSR免费分享网站(所有帐号均来源于网上别人的分享):http://ss.pythonic.life
# 源代码主页:https://github.com/the0demiurge
# 访问https://github.com/the0demiurge/CharlesScripts/blob/master/charles/bin/ssr获取本脚本的最新版
#使用方法:把该脚本放到$PATH里面并加入可执行权限就行(比如说放到/usr/local/bin)
#首次使用输入ssr install后安装时会自动安装到/usr/local/share/shadowsocksr
#输入ssr config进行配置,输入JSON格式的配置文件
#输入ssr uninstall卸载
#输入ssr help 现实帮助信息
set -e
if [ -z $EDITOR ];then
EDITOR=vi
fi
help() {
echo ShadowSocksR python client tool
echo -e if you have not install ssr, please run \"ssr install\"
echo Usage:
echo -e "\t" ssr help
echo -e "\t" ssr config : edit config.json
echo -e "\t" ssr install : install shadowsocksr client
echo -e "\t" ssr uninstall : uninstall shadowsocksr client
echo -e "\t" ssr start : start the shadowsocks service
echo -e "\t" ssr stop : stop the shadowsocks service
echo -e "\t" ssr log : cat the log of shadowsocks
}
install_path=/usr/local/share/shadowsocksr
if [ $# == 0 ];then
help
elif [ $1 == "help" ];then
help
elif [ $1 == "install" ];then
sudo git clone -b manyuser https://github.com/shadowsocksr-backup/shadowsocksr.git $install_path
# sudo git clone -b rm https://github.com/the0demiurge/not-in-use.git $install_path
elif [ $1 == "uninstall" ];then
echo "Danger! are you to remove $install_path forever?(y/N)"
read doit
if [ $doit == 'y' ];then
sudo rm -rvf $install_path
fi
elif [ $1 == "config" ];then
sudo $EDITOR $install_path/config.json
cd $install_path/shadowsocks/
sudo python local.py -d stop
sudo python local.py -d start
elif [ $1 == "start" ];then
cd $install_path/shadowsocks/
sudo python local.py -d start
elif [ $1 == "stop" ];then
cd $install_path/shadowsocks/
sudo python local.py -d stop
elif [ $1 == "log" ];then
tail -f /var/log/shadowsocks.log
elif [ $1 == "shell" ];then
cd $install_path/shadowsocks/
sudo python local.py $@
fi