Created
September 26, 2012 10:30
-
-
Save fgarcia/3787239 to your computer and use it in GitHub Desktop.
check if remote ssh server is running
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
status=$(ssh -o BatchMode=yes -o ConnectTimeout=5 $ip echo ok 2>&1) | |
if [[ $status == ok ]] ; then | |
echo $ip $host >> good | |
elif [[ $status == "Permission denied"* ]] ; then | |
echo $ip $host $status >> no_auth | |
else | |
echo $ip $host $status >> other | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment