#!/bin/bash
tomcatcheck()
{
statusNum=200
contentmin=100000
statusnum=$(curl -I www.mayi.com 2>/dev/null | awk '/HTTP/ {print $2}')
contentsize=$(curl -I www.mayi.com 2>/dev/null | awk '/Content-Length/ {print $2}')
num=3
while ((num > 0));
do
if [ "${statusnum}" = "${statusNum}" -a echo ${contentsize} | awk -v zzh=${contentmin} '{print($1>zzh)? "1":"0"}'
-gt "0" ];then
echo 'tomcat ok'
break
else
echo 'tomcat restart'
fi
num=$((num - 1))
sleep 3
done
}
tomcatcheck
转载于:https://blog.51cto.com/myunix/2051235