Created
May 3, 2018 10:54
-
-
Save davidcrx/40013e70f939cbc481506f4fccc81fc3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#Comprovar número de paràmetres | |
#Mirar si una web està online | |
if [ $# -ne 1 ]; then | |
echo "Número de argumentos no validos, sólo se permite 1" | |
exit 1 | |
fi | |
WEB=$1 | |
code=`curl -s -I $1 | head -n 1 | cut -d ' ' -f2` | |
if [ $code -eq 200 ]; then | |
echo "Pagina funcionado! Code 200" | |
elif [ $code -eq 404 ]; then | |
echo "Error 404, archivo no encontrado" | |
elif [ $code -eq 302 ]; then | |
echo "Pagina funcionando en HTTP! Code 302" | |
elif [ $code -eq 301 ]; then | |
echo "Página movida permanentemente! Code 301" | |
else | |
echo "Pagina no funcionando" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment