From b1fbdf8d60d6d9ba84dc26429104deb04809e92b Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 18 Nov 2023 17:08:59 +0800 Subject: [PATCH] Update mw.tpl --- scripts/init.d/mw.tpl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index 502b3b6e8..825e2263a 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -217,10 +217,11 @@ error_logs() mw_update() { LOCAL_ADDR=common - ping -c 1 github.com > /dev/null 2>&1 - if [ "$?" != "0" ];then + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then LOCAL_ADDR=cn fi + if [ "$LOCAL_ADDR" == "common" ];then curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash else @@ -251,7 +252,7 @@ mw_mirror() if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then LOCAL_ADDR=cn fi - + if [ "$LOCAL_ADDR" == "common" ];then bash <(curl --insecure -sSL https://raw.githubusercontent.com/midoks/change-linux-mirrors/main/change-mirrors.sh) else