@@ -15,6 +15,8 @@ BASE=`pwd`
15
15
16
16
OS=` hostnamectl | grep -i system | cut -d: -f2`
17
17
18
+ CONFIG_FILE=" /etc/shadowsocksR.json"
19
+
18
20
colorEcho () {
19
21
echo -e " ${1}${@: 2}${PLAIN} "
20
22
}
@@ -300,7 +302,7 @@ installSSR() {
300
302
cd ${BASE} && rm -rf shadowsocksr-3.2.2 ${FILENAME} .tar.gz
301
303
fi
302
304
303
- cat > /etc/shadowsocksR.json << -EOF
305
+ cat > $CONFIG_FILE << -EOF
304
306
{
305
307
"server":"0.0.0.0",
306
308
"server_ipv6":"[::]",
@@ -330,7 +332,7 @@ Wants=network-online.target
330
332
[Service]
331
333
Type=forking
332
334
LimitNOFILE=32768
333
- ExecStart=/usr/local/shadowsocks/server.py -c /etc/shadowsocksR.json -d start
335
+ ExecStart=/usr/local/shadowsocks/server.py -c $CONFIG_FILE -d start
334
336
ExecReload=/bin/kill -s HUP \$ MAINPID
335
337
ExecStop=/bin/kill -s TERM \$ MAINPID
336
338
@@ -429,13 +431,13 @@ installBBR() {
429
431
430
432
info () {
431
433
ip=` curl -sL -4 ip.sb`
432
- port=` cat /etc/shadowsocksR.json | grep server_port | cut -d: -f2 | tr -d \" ,' ' `
434
+ port=` grep server_port $CONFIG_FILE | cut -d: -f2 | tr -d \" ,' ' `
433
435
res=` netstat -nltp | grep ${port} | grep python`
434
436
[[ -z " $res " ]] && status=" ${RED} 已停止${PLAIN} " || status=" ${GREEN} 正在运行${PLAIN} "
435
- password=` cat /etc/shadowsocksR.json | grep password | cut -d: -f2 | tr -d \" ,' ' `
436
- method=` cat /etc/shadowsocksR.json | grep method | cut -d: -f2 | tr -d \" ,' ' `
437
- protocol=` cat /etc/shadowsocksR.json | grep protocol | cut -d: -f2 | tr -d \" ,' ' `
438
- obfs=` cat /etc/shadowsocksR.json | grep obfs | cut -d: -f2 | tr -d \" ,' ' `
437
+ password=` grep password $CONFIG_FILE | cut -d: -f2 | tr -d \" ,' ' `
438
+ method=` grep method $CONFIG_FILE | cut -d: -f2 | tr -d \" ,' ' `
439
+ protocol=` grep protocol $CONFIG_FILE | cut -d: -f2 | tr -d \" ,' ' `
440
+ obfs=` grep obfs $CONFIG_FILE | cut -d: -f2 | tr -d \" ,' ' `
439
441
440
442
p1=` echo -n ${password} | base64 -w 0`
441
443
p1=` echo -n ${p1} | tr -d =`
@@ -446,7 +448,7 @@ info() {
446
448
echo " "
447
449
echo ============================================
448
450
echo -e " ${BLUE} ssr运行状态:${PLAIN}${status} "
449
- echo -e " ${BLUE} ssr配置文件:${PLAIN}${RED} /etc/shadowsocksR.json ${PLAIN} "
451
+ echo -e " ${BLUE} ssr配置文件:${PLAIN}${RED} $CONFIG_FILE ${PLAIN} "
450
452
echo " "
451
453
echo -e " ${RED} ssr配置信息:${PLAIN} "
452
454
echo -e " ${BLUE} IP(address):${PLAIN} ${RED}${ip}${PLAIN} "
@@ -491,7 +493,7 @@ uninstall() {
491
493
[[ -z ${answer} ]] && answer=" n"
492
494
493
495
if [[ " ${answer} " == " y" ]] || [[ " ${answer} " == " Y" ]]; then
494
- rm -f /etc/shadowsocksR.json
496
+ rm -f $CONFIG_FILE
495
497
rm -f /var/log/shadowsocks.log
496
498
rm -rf /usr/local/shadowsocks
497
499
systemctl disable shadowsocksR && systemctl stop shadowsocksR && rm -rf /usr/lib/systemd/system/shadowsocksR.service
0 commit comments