github.com/ssube/gitlab-ci-multi-runner@v1.2.1-0.20160607142738-b8d1285632e6/dockerfiles/service/wait (about)

     1  #!/bin/sh
     2  
     3  host=$(env | grep -m1 _TCP_ADDR | cut -d = -f 2)
     4  port=$(env | grep -m1 _TCP_PORT | cut -d = -f 2)
     5  
     6  if [ -z "$host" ] || [ -z "$port" ]; then
     7  	echo "No HOST or PORT"
     8  fi
     9  
    10  echo -n "waiting for TCP connection to $host:$port..."
    11  
    12  while ! nc -w 1 $host $port 2>/dev/null
    13  do
    14    echo -n .
    15    sleep 1
    16  done
    17  
    18  echo 'ok'