Created
July 3, 2015 06:55
-
-
Save TheHiddenHaku/2e25cbc7f6bea99f0211 to your computer and use it in GitHub Desktop.
Revisions
-
TheHiddenHaku created this gist
Jul 3, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ read -e -p "Inserisci il server/dominio da controllare: " yourURL read -e -p "Ora inserisci il percorso sul server da aprire: " yourPath ((count = 1000000)) # Maximum number to try. while [[ $count -ne 0 ]] ; do ping -c 1 "$yourURL" # Try once. rc=$? if [[ $rc -eq 0 ]] ; then ((count = 1)) # If okay, flag to exit loop. fi echo "Ping Timeout. Dominio non risolve o è protetto." ((count = count - 1)) # So we don't go forever. done if [[ $rc -eq 0 ]] ; then # Make final determination. while [ 1 ] do if curl --output /dev/null --silent --head --fail "http://$yourURL$yourPath" then echo "Url trovata! Apriamo il sito" open "http://$yourURL$yourPath" exit else echo "Il dominio risolve, ma restituisce errore (Url non trovata)" fi done else echo "Ping Timeout. Dominio non risolve o è protetto." fi