aboutsummaryrefslogtreecommitdiffstats
path: root/docker_files/wait_for_host_port.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker_files/wait_for_host_port.sh')
-rwxr-xr-xdocker_files/wait_for_host_port.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/docker_files/wait_for_host_port.sh b/docker_files/wait_for_host_port.sh
new file mode 100755
index 0000000..e4e4bf9
--- /dev/null
+++ b/docker_files/wait_for_host_port.sh
@@ -0,0 +1,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