日期:2014-05-16 浏览次数:20341 次
#!/bin/sh
?
PATH=/usr/local/jdk1.5.0_19/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
JAVA_HOME=/usr/local/jdk1.5.0_19
CLASSPATH=.:/usr/local/jdk1.5.0_19/lib:/usr/local/jdk1.5.0_19/lib/tool.jar:/usr/local/jdk1.5.0_19/lib/dt.jar:
LANG=zh_CN.GB18030
export JAVA_HOME PATH CLASSPATH LANG
?
test -e "test.jsp" && rm -f test.jsp
test -e "wget-log" && rm -f wget-log
?
wget -b "http://127.0.0.1/portal/test.jsp" > /dev/null 2>&1
sleep 2
?
tom=`cat test.jsp`
if?
? ?[ "$tom" == "200" ] ;then
? ? ?echo "`date +%d/%m/%Y:%H:%M:%S` - - tomcatserver is ok!"
? ? ?echo " "
? ? ?echo "-------------------------"
? ? ?exit 0
? ? ?elif?
? [ "$tom" != "200" ] ;then
? ? ?sh /usr/local/tomcat5/bin/shutdown.sh
? ? ?sh /usr/local/tomcat5/bin/startup.sh
? ? ?echo "`date +%d/%m/%Y:%H:%M:%S` - - tomcatserver is down!restart is successful!"
? ? ?curl "http://sms.api.bz/fetion.php?username=150********&password=******&sendto=150********&message=tomcat服务器down机,重启成功!"
? ? ?echo " "
? ? ?echo "-------------------------"
fi
?
?
test.jsp
?<%out.print("200");%>
?
?
?
?
另外一个监控内存的段落