Created
April 4, 2015 10:01
-
-
Save atika/ef2ad4a508ca4279ee45 to your computer and use it in GitHub Desktop.
Check until host is up using PING
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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