Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check website availability then reboot services if needed
#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
You can’t perform that action at this time.