Skip to content

Instantly share code, notes, and snippets.

@davidcrx
Created May 3, 2018 10:54
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 davidcrx/40013e70f939cbc481506f4fccc81fc3 to your computer and use it in GitHub Desktop.
Save davidcrx/40013e70f939cbc481506f4fccc81fc3 to your computer and use it in GitHub Desktop.
#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