Skip to content
Snippets Groups Projects
Commit d8d886e7 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

update do.bash

parent a7884e2c
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/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 () { function confirm_alive () {
local host="$1" local host="$1"
...@@ -8,7 +10,7 @@ function confirm_alive () { ...@@ -8,7 +10,7 @@ function confirm_alive () {
local ret="$?" local ret="$?"
[[ $ret != 124 ]] && [[ $ret != 2 ]] && return $ret [[ $ret != 124 ]] && [[ $ret != 2 ]] && return $ret
for i in {1..4}; do 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 sleep 1
done done
return 124 return 124
...@@ -39,11 +41,11 @@ function do_test () { ...@@ -39,11 +41,11 @@ function do_test () {
;; ;;
drive ) drive )
confirm_alive drive.recolic.net && 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 && confirm_alive nohsts.tw1.recolic.org &&
test_ss base.tw1.recolic.net || return $? test_tcp base.tw1.recolic.net 465 || return $?
;; ;;
ss-us1 ) ss-us1 )
test_ss base.us1.recolic.net || return $? test_ss base.us1.recolic.net || return $?
...@@ -140,7 +142,7 @@ function do_test () { ...@@ -140,7 +142,7 @@ function do_test () {
;; ;;
rocket ) rocket )
confirm_alive rocket.recolic.net && 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 esac
} }
...@@ -153,7 +155,7 @@ function do_test_twice () { ...@@ -153,7 +155,7 @@ function do_test_twice () {
if [[ "$1" = all ]]; then if [[ "$1" = all ]]; then
do_test_twice rproxy && do_test_twice rproxy &&
do_test_twice drive && do_test_twice drive &&
do_test_twice ss-tw && do_test_twice ssr-tw &&
do_test_twice ss-us1 && do_test_twice ss-us1 &&
do_test_twice ss-us5 && do_test_twice ss-us5 &&
do_test_twice ss-us6 && do_test_twice ss-us6 &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment