diff --git a/do.bash b/do.bash index fa34d5927032950ea290e2f318e9ad29d8189860..f2ae89511ac0da75307b4d1eb65952293bb1eb69 100755 --- a/do.bash +++ b/do.bash @@ -1,6 +1,8 @@ #!/bin/bash -[[ $1 == '' ]] && echo -e 'Usage: '"$0 <operation> ...\n operation := rproxy | drive | ss-tw | ss-us1 | ss-us5 | ss-us6 | ovpn-tw | www | mail | tm | git | zhixiang | mc | push-httpdb-agent | ddns-wuhan | rocket | dl | shortlink | all" && exit 1 +[[ $1 == '' ]] && echo -e 'Usage: '"$0 <operation> ...\n operation := rproxy | drive | ssr-tw | ss-us1 | ss-us5 | ss-us6 | ovpn-tw | www | mail | tm | git | zhixiang | mc | push-httpdb-agent | ddns-wuhan | rocket | dl | shortlink | all" && exit 1 + +[[ $(id -u) = 0 ]] && ping_fld="-f" function confirm_alive () { local host="$1" @@ -8,7 +10,7 @@ function confirm_alive () { local ret="$?" [[ $ret != 124 ]] && [[ $ret != 2 ]] && return $ret for i in {1..4}; do - timeout 3s ping "$host" -c 1 && return 0 + timeout 12s ping "$host" -c 1 $ping_fld && return 0 sleep 1 done return 124 @@ -39,11 +41,11 @@ function do_test () { ;; drive ) confirm_alive drive.recolic.net && - curl -s https://drive.recolic.net/index.php/login | grep 'submit-wrapper' || return $? + curl -s https://drive.recolic.net:444/index.php/login | grep 'submit-wrapper' || return $? ;; - ss-tw ) + ssr-tw ) confirm_alive nohsts.tw1.recolic.org && - test_ss base.tw1.recolic.net || return $? + test_tcp base.tw1.recolic.net 465 || return $? ;; ss-us1 ) test_ss base.us1.recolic.net || return $? @@ -140,7 +142,7 @@ function do_test () { ;; rocket ) confirm_alive rocket.recolic.net && - curl -s https://rocket.recolic.net/api/info | grep 'success":true' || return $? + curl -s https://rocket.recolic.net:444/api/info | grep 'success":true' || return $? ;; esac } @@ -153,7 +155,7 @@ function do_test_twice () { if [[ "$1" = all ]]; then do_test_twice rproxy && do_test_twice drive && - do_test_twice ss-tw && + do_test_twice ssr-tw && do_test_twice ss-us1 && do_test_twice ss-us5 && do_test_twice ss-us6 &&