Skip to content

Instantly share code, notes, and snippets.

@bcg
Created October 26, 2015 17:35
Show Gist options
  • Save bcg/eb13de763e4f574f254f to your computer and use it in GitHub Desktop.
Save bcg/eb13de763e4f574f254f to your computer and use it in GitHub Desktop.
#!/bin/bash
ENVS=(`env|grep _TCP_ADDR`)
for addr_env in "${ENVS[@]}"
do
address=`echo $addr_env|cut -d \= -f 2`
port=`printenv ${addr_env%_ADDR*}_PORT`
echo "Waiting on TCP connection to $address:$port"
while ! exec 6<>/dev/tcp/${address}/${port}; do
sleep 2
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment