#! /Bin/shpath =/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/binjava_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.gb18030export java_home path classpath langtest-e "test. JSP "& Rm-F test. jsptest-e "wget-log" & RM -F wget-logwget-B "http: // 127.0.0.1/portal/test. JSP ">/dev/null 2> & 1 sleep 2tom = '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 server down, reboot successful! "Echo" "Echo" ------------------------------------------------------------- "fi
Determine the Tomcat status by judging the return value of the test. jsp page, and enable SMS alarms. (You can send text messages to yourself if you have the Apsara account password)
Join the system task to check once every 2 minutes
# Vi/usr/local/sbin/checktom. Sh