github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/_utils/check_http_alive (about) 1 #!/bin/bash 2 # parameter 1: url, only GET method supported now 3 # parameter 2: text needs to be contained 4 # parameter 3: retry count, if check failed we will wait 1s before next retry, until retry time exceeds retry count 5 6 set -eu 7 8 url=$1 9 contain=$2 10 retry_count=$3 11 12 shift 3 13 14 counter=0 15 while [ $counter -lt $retry_count ]; do 16 got=$(curl -s $url | grep "$contain" | wc -l) 17 if [[ $got -gt 0 ]]; then 18 echo "HTTP $url is alive" 19 exit 0 20 fi 21 ((counter += 1)) 22 echo "wait for HTTP alive for $counter-th time" 23 sleep 1 24 done 25 26 echo "HTTP $url is not alive" 27 exit 1