File tree 1 file changed +26
-9
lines changed
1 file changed +26
-9
lines changed Original file line number Diff line number Diff line change 1
1
#! /system/bin/sh
2
2
3
- box_dir=/data/adb/box
3
+ # Definisi variabel
4
+ box_dir=" /data/adb/box"
4
5
box_run=" ${box_dir} /run"
5
6
box_pid=" ${box_run} /box.pid"
6
7
7
- if [ -f " ${box_pid} " ]; then
8
- echo " 正在关闭服务…"
8
+ run_as_su () {
9
+ su -c " $1 "
10
+ }
11
+
12
+ stop_service () {
9
13
echo " Service is shutting down"
10
- su -c $box_dir /scripts/box.iptables disable && su -c $box_dir /scripts/box.service stop
14
+ run_as_su " ${box_dir} /scripts/box.iptables disable"
15
+ run_as_su " ${box_dir} /scripts/box.service stop"
16
+ }
17
+
18
+ start_service () {
19
+ echo " Service is starting, please wait for a moment"
20
+ run_as_su " ${box_dir} /scripts/box.service start"
21
+ run_as_su " ${box_dir} /scripts/box.iptables enable"
22
+ }
23
+
24
+ if [ -f " ${box_pid} " ]; then
25
+ PID=$( cat " ${box_pid} " )
26
+ if [ -e " /proc/${PID} " ]; then
27
+ stop_service
28
+ else
29
+ start_service
30
+ fi
11
31
else
12
- echo " 正在启动服务,请耐心等待…"
13
- echo " Service is starting,please wait for a moment"
14
- su -c $box_dir /scripts/box.service start && su -c $box_dir /scripts/box.iptables enable
15
- exit
16
- fi
32
+ start_service
33
+ fi
You can’t perform that action at this time.
0 commit comments