forked from MrKsey/ss-tls-v2ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestart_svc.sh
59 lines (51 loc) · 1.7 KB
/
restart_svc.sh
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
#!/bin/bash
echo " "
echo "=================================================="
echo "$(date): restart_svc.sh started"
echo "=================================================="
echo " "
if [ -s /etc/shadowsocks/.config.env ]; then
set -a; . /etc/shadowsocks/.config.env; set +a
fi
# Restart ShadowSocks
if [ "$SS_ENABLED" = "true" ]; then
/etc/init.d/ss.sh restart
else
if [ "$MODE" = "server" ]; then
/etc/init.d/ss.sh restart
else
/etc/init.d/ss.sh stop
fi
fi
# Restart Simple TLS
if [ "$SIMPLE_TLS_ENABLED" = "true" ]; then
/etc/init.d/ss-simple-tls.sh restart
else
/etc/init.d/ss-simple-tls.sh stop
fi
# Restart V2RAY
if [ "$V2RAY_ENABLED" = "true" ]; then
/etc/init.d/ss-v2ray.sh restart
else
/etc/init.d/ss-v2ray.sh stop
fi
sleep 5
echo " "
echo "==========================================================================="
echo "$(date): Services status:"
echo "==========================================================================="
/etc/init.d/ss.sh status
echo "==========================================================================="
/etc/init.d/ss-simple-tls.sh status
echo "==========================================================================="
/etc/init.d/ss-v2ray.sh status
echo " "
# Start new monitoring config.ini
ls /etc/shadowsocks/config.ini | entr -npsz 'echo " " && echo "===========================================================================" \
&& echo "$(date): config.ini changed. Applying new settings..." && echo " " \
&& /config.sh && /restart_svc.sh' &
echo " "
echo "=================================================="
echo "$(date): restart_svc.sh finished"
echo "=================================================="
echo " "