github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/_utils/check_port_alive (about) 1 #!/bin/bash 2 # parameter 1: port 3 4 port=$1 5 6 i=0 7 while [ $i -lt 20 ]; do 8 check_port 127.0.0.1 $port >/dev/null 2>&1 9 ret=$? 10 if [ "$ret" == 0 ]; then 11 echo "port $port is alive" 12 break 13 fi 14 ((i++)) 15 echo "wait for port $port alive the $i-th time" 16 sleep 1 17 done 18 19 if [ $i -ge 20 ]; then 20 echo "port $port check alive timeout" 21 exit 1 22 fi