Skip to content

Instantly share code, notes, and snippets.

@atika
Created April 4, 2015 10:01
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 atika/ef2ad4a508ca4279ee45 to your computer and use it in GitHub Desktop.
Save atika/ef2ad4a508ca4279ee45 to your computer and use it in GitHub Desktop.
Check until host is up using PING
# Check until host is UP
checkisup () { while (true) do if ping -t 2 -c 1 $1 &>/dev/null; then echo -e " $(date +%T) \\033[1;36m Host $1 is up! \\033[0m\n $(ping -c 1 $1 | head -n2 | tail -n1)"; return 0; else echo -e " $(date +%T) \\033[31m Host $1 is down...\\033[0m"; sleep 1; fi; done; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment