Last active
September 4, 2015 03:36
-
-
Save chixq/eb1f1f0d898a36600e7f to your computer and use it in GitHub Desktop.
verify site accessibility
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
wget -q --tries=2 --timeout=5 --spider $1|| echo "unaccessible"; |
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
#!/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