Created
March 31, 2017 01:05
-
-
Save ttlequals0/080222f4fe8e8d9c640d43d249fa11a3 to your computer and use it in GitHub Desktop.
isitup
This file contains 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
isitup () { | |
ip=$1 | |
while [ "$status" != "0" ] | |
do | |
echo -e "$ip is down!" | |
sleep 15 | |
ssh-keyscan $ip 2>&1 | grep -v "^$" > /dev/null | |
status=$? | |
done | |
echo " $ip is up!" | |
} | |
Output: | |
10.16.92.62 is down! | |
10.16.92.62 is down! | |
10.16.92.62 is down! | |
10.16.92.62 is up! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment