forked from docker-easyconnect/docker-easyconnect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-sangfor.sh
executable file
·37 lines (33 loc) · 1.27 KB
/
start-sangfor.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
#!/bin/bash
[ -z "$_EC_CLI" ] && /usr/share/sangfor/EasyConnect/resources/bin/EasyMonitor
sleep 1
while true
do
if [ -z "$_EC_CLI" ]; then
# 在 EasyConnect 前端启动过程中,会出现 cms client connect failed 的报错,此时应该启动 sslservice.sh。但这个脚本启动得太早也会没有作用……
# 参考了 https://blog.51cto.com/13226459/2476193 ,在此对作者表示感谢。
{
tail -n 0 -f /usr/share/sangfor/EasyConnect/resources/logs/ECAgent.log | grep "\\[Register\\]cms client connect failed" -m 1
/usr/share/sangfor/EasyConnect/resources/shell/sslservice.sh
} &
# 下面这行代码启动 EasyConnect 的前端。
/usr/share/sangfor/EasyConnect/EasyConnect --enable-transparent-visuals --disable-gpu
else
/usr/share/sangfor/EasyConnect/resources/bin/ECAgent &
sleep 1
easyconn login -t autologin
pidof svpnservice > /dev/null || bash -c "exec easyconn login $CLI_OPTS"
while pidof svpnservice > /dev/null ; do
sleep 1
done
echo svpn stop!
fi
# 是否自动重启
[ -n "$EXIT" ] && exit
# 清除的残余进程,它们可能会妨碍下次的启动。
killall CSClient svpnservice 2> /dev/null
kill %1 %2 2> /dev/null
sleep 4
# 只要杀不死,就往死里杀
killall -9 CSClient svpnservice 2> /dev/null
done