Skip to content

Instantly share code, notes, and snippets.

@mkhl
Forked from michael-simons/wait_for_bolt.sh
Last active April 23, 2021 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkhl/f0406a5ee427a4a337b590b7b06b575c to your computer and use it in GitHub Desktop.
Save mkhl/f0406a5ee427a4a337b590b7b06b575c to your computer and use it in GitHub Desktop.
A bash script waiting for port some host and port to become available without netcat or similar
#!/usr/bin/env bash
host=${1:?missing host}
port=${2:?missing port}
timeout=${3:-180}
until (exec 3<>"/dev/tcp/$host/$port") &>/dev/null; do
((timeout == 0)) && exit 1
((timeout--))
echo -n .
sleep 1
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment