Skip to content

Instantly share code, notes, and snippets.

@ttlequals0
Created March 31, 2017 01:05
Show Gist options
  • Save ttlequals0/080222f4fe8e8d9c640d43d249fa11a3 to your computer and use it in GitHub Desktop.
Save ttlequals0/080222f4fe8e8d9c640d43d249fa11a3 to your computer and use it in GitHub Desktop.
isitup
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