Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Created September 26, 2012 10:30
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 fgarcia/3787239 to your computer and use it in GitHub Desktop.
Save fgarcia/3787239 to your computer and use it in GitHub Desktop.
check if remote ssh server is running
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