aboutsummaryrefslogtreecommitdiffstats
path: root/docker_files/wait_for_host_port.sh
blob: e4e4bf9ce637bbfe1f55ff0a0d73394ea2745e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

set -e

host="$1"
port="$2"
shift
shift
cmd="$@"

until echo > /dev/tcp/${host}/${port} ; do
  >&2 echo "${host}:${port} is unavailable - sleeping"
  sleep 1
done

>&2 echo "${host}:${port} is up - executing command"
exec $cmd