Created
August 27, 2016 11:44
-
-
Save MattLoyeD/11926e5a2c2f6662d8415b89ce3368d8 to your computer and use it in GitHub Desktop.
Check website availability then reboot services if needed
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
#runs a check of your website http code response (Bad gateway, empty response, or service off) every half minute then send sms if reboot via Free Mobile API | |
jobjob() | |
{ | |
var=`curl -I http://www.zogzog.com/ 2>/dev/null | head -n 1 | awk -F" " '{print $2}'` | |
if [[ -z "$var" ]] || [ "$var" == "502" ] || [ "$var" == "324" ] | |
then | |
curl -I "https://smsapi.free-mobile.fr/sendmsg?user=___&pass=___&msg=$var%20Serv%20Autorestart%20!"; | |
sudo service nginx restart; sudo service php7.0-fpm restart; | |
else | |
echo "$var"; | |
fi | |
} | |
jobjob; | |
sleep 25; | |
jobjob; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment