22 lines
696 B
Bash
Executable File
22 lines
696 B
Bash
Executable File
#!/bin/sh
|
|
[ "$1" = check ] || exit 1
|
|
NAME=bypass
|
|
|
|
log(){
|
|
echo "$(date +'%Y-%m-%d %H:%M:%S') : $*" >> /var/log/$NAME.log
|
|
}
|
|
|
|
sleep 2
|
|
while ! curl -so /dev/null -m 3 www.baidu.com;do
|
|
sleep 2
|
|
done
|
|
log "Check network status successful!"
|
|
if [ -z "$(uci -q get $NAME.@global[0].global_server)" ];then
|
|
/etc/init.d/$NAME start &
|
|
elif ([ "$(uci -q get $NAME.@global[0].run_mode)" = router ] && [ ! -s /tmp/$NAME/china.txt -o ! -s /tmp/$NAME/china_v6.txt ]) || ([ "$(uci -q get $NAME.@global[0].run_mode)" = gfw -o "$(uci -q get $NAME.@global[0].gfw_mode)" = 1 ] && [ ! -s /tmp/$NAME/gfw.list ]);then
|
|
log "Download IP/GFW files..."
|
|
/usr/share/$NAME/update --First &
|
|
else
|
|
/etc/init.d/$NAME start &
|
|
fi
|