Skip to content

Instantly share code, notes, and snippets.

@chockenberry
Last active October 22, 2020 19:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chockenberry/09c66fd31dec45a708e61f4763e58c22 to your computer and use it in GitHub Desktop.
Save chockenberry/09c66fd31dec45a708e61f4763e58c22 to your computer and use it in GitHub Desktop.
#!/bin/sh
# usage: waitfor.sh myserver.example.com
ping_func(){
host="$1"
$(ping -c 1 -t 1 "$host" &> /dev/null)
return $?
}
result=2
while [[ $result -eq 2 ]]; do
echo ".\c"
ping_func $1
result=$?
done
echo ""
say "$1 ready"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment