Skip to content

Instantly share code, notes, and snippets.

Last active December 9, 2019 10:50
What would you like to do?
Example wait for script
#!/usr/bin/env bash
STOP_TIME=`date -d "now + 30 seconds" +%s`
# loop until we get a connection
until nc -z localhost 3306
# if current time is > STOP_TIME, timeout has been exceeded so exit
if [[ `date +%s` -gt $STOP_TIME ]]; then
echo Timed out waiting for connection
exit 1
sleep 1
echo Successfully connected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment