Shell script checks Tomcat run state

Source: Internet
Author: User

path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/binexport  Java_home=/usr/java  export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar   export path= $PATH: $JAVA _home/bin:/usr/local/pcre/bin:/usr/local/ffmpeg/bin tomcatid= ' ps - ef|grep tomcat-5.5|grep -v  ' grep ' |head -1|awk  ' {print $2} ' StartTomcat=/usr/ local/tool/tomcat-5.5/bin/startup.shweburl=http://localhost:8080tomcatmonitorlog=/var/log/ Tomcatmonitor.logmonitor () {echo  "START CHECK TOMCAT .." if [  $TomcatID  ];then  echo  "the tomcatid is  $TomcatID"    tomcatservercode= ' curl -i  $Weburl  > /etc/swd/status.txt '   Status= ' cat  /etc/swd/status.txt|head -1|awk  ' {print $2} ' if [  $Status  -eq 200  ];then  echo  "Tomcat is ok" else  echo "Tomcat is error"   kill -9  $TomcatID   sleep 3  $ starttomcatfi  fi}monitor >>  $TomcatMonitorlog
*/5 * * * */etc/swd/ >/dev/null 2>&1

This article is from the "Liang Enyu-9527" blog, be sure to keep this source

Shell script checks Tomcat run state

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.