Skip to content

Instantly share code, notes, and snippets.

@chixq
Last active September 4, 2015 03:36
Embed
What would you like to do?
verify site accessibility
wget -q --tries=2 --timeout=5 --spider $1|| echo "unaccessible";
#!/bin/bash
isAccessible ()
{
if [ "x$1" == "x" ]; then
return 1
fi
accessible=0
curl -s --head --retry 2 --retry-delay 1 -m 10 $1 -o /dev/null || accessible=1
return ${accessible}
}
isAccessible ssssssssbaidu.com
if [ $? == 1 ];then
echo "not accessible"
else
echo "accesible"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment