diff --git a/do.bash b/do.bash index c7ca88d9d2aaa6824772af7f24de927c54f7ee40..2d8767f7c9658c6e7354daab471c098fab3f8589 100755 --- a/do.bash +++ b/do.bash @@ -2,13 +2,15 @@ [[ $1 == '' ]] && echo -e 'Usage: '"$0 <operation> ...\n operation := rproxy | drive | ssr-tw | ssr-hk | frp-hk | 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" timeout 4s ping "$host" -c 1 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