Code Review
/
policy
/
engine.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bound wait time for a component's port
[policy/engine.git]
/
packages
/
docker
/
src
/
main
/
docker
/
wait-for-port.sh
diff --git
a/packages/docker/src/main/docker/wait-for-port.sh
b/packages/docker/src/main/docker/wait-for-port.sh
index
befebf2
..
15c6eb8
100644
(file)
--- a/
packages/docker/src/main/docker/wait-for-port.sh
+++ b/
packages/docker/src/main/docker/wait-for-port.sh
@@
-25,14
+25,17
@@
if [[ $# -ne 2 ]]; then
exit 1
fi
exit 1
fi
-host=$1
-port=$2
+
export
host=$1
+
export
port=$2
echo "Waiting for $host port $port open"
echo "Waiting for $host port $port open"
-until nc -vz $host $port 2> /dev/null; do
- sleep 1
-done
+timeout 120 bash -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done'
+rc=$?
-echo "$host port $port is open"
+if [[ $rc != 0 ]]; then
+ echo "$host port $port cannot be reached"
+ exit $rc
+fi
+echo "$host port $port is open"
exit 0
exit 0