#!/bin/bash
#Description: check web server
#source /etc/profile
#LOG="/home/jiankong_shell/log"
DATE=`date +%y%m%d-%H:%M`
a=0
#mkdir -p /home/jiankong_shell/log
while [ $a -lt 3 ]
do
RESULT=$(curl -o /dev/null -s -w %{http_code} http://127.0.0.1:8080)
echo -----------------$RESULT
if [ $RESULT -eq "200" ]
then
echo ****************success****************$RESULT
break
fi
a=`expr $a + 1`
# sleep 10
done
if [ $a -eq 3 ]
then
systemctl restart tomcat
echo **[$DATE]****************error[$a]*****restart***********
# echo **[$DATE]****************error[$a]*****restart***********>>$LOG/$DATE.down
fi