Skip to content

Commit cd8ed1e

Browse files
committed
1.修复了保活时改掉list文件的问题
2.优化了显示singbox链接信息的逻辑
1 parent a314cc3 commit cd8ed1e

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

singbox/start.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ else
1717
type=$1
1818
fi
1919

20+
keep=$2
21+
2022
run() {
2123
if ps aux | grep cloudflared | grep -v "grep" >/dev/null; then
2224
return
@@ -70,15 +72,21 @@ EOF
7072
cat list
7173
}
7274

75+
if [ "$keep" = "list" ]; then
76+
export_list
77+
exit 0
78+
fi
79+
7380
if [[ "$type" == "1" || "$type" == "3" ]]; then
7481
run
7582
fi
7683
if [[ "$type" == "1" || "$type" == "2" || "$type" == "3" ]]; then
7784
chmod +x ./serv00sb
78-
if ps aux | grep serv00sb | grep -v "grep" >/dev/null; then
79-
exit 0
85+
if ! ps aux | grep serv00sb | grep -v "grep" >/dev/null; then
86+
nohup ./serv00sb run -c ./config.json >/dev/null 2>&1 &
8087
fi
81-
nohup ./serv00sb run -c ./config.json >/dev/null 2>&1 &
8288

8389
fi
84-
export_list
90+
if [ -z "$keep" ]; then
91+
export_list
92+
fi

start.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,13 @@ showSingBoxInfo(){
259259
red "配置文件不存在,请先行配置!"
260260
return
261261
fi
262-
263262
if [ ! -e list ]; then
264263
red "请先运行sing-box"
265264
fi
266-
cat ./list
265+
config="singbox.json"
266+
type=$(jq -r ".TYPE" $config)
267+
chmod +x ./start.sh && ./start.sh $type list
268+
267269
}
268270

269271
writeWX(){

0 commit comments

Comments
 (0)