Linux automatically restarts Tomcat script sharing _linux Shell

Source: Internet
Author: User
Tags stop script
Copy Code code as follows:

#!/bin/bash
#
#chkconfig: 35 88 14
#description: Tomcat Auto Start script
#script by Okhelper
Case "$" in
Start
echo "Here is start script ..."
java_home=/usr/jdk1.6.0_13;
Export Java_home
Jre_home= $JAVA _home/jre;
Export Jre_home
Export path= $PATH: $JAVA _home/bin
Export classpath=./: $JAVA _home/lib: $JAVA _home/jre/lib
Date + "%y-%m-%d%t:starting tomcat ..." >>/var/log/tomcat.log
/software/apache-tomcat-6.0.32/bin/startup.sh >>/var/log/tomcat.log
Date + "%y-%m-%d%t:tomcat started ..." >>/var/log/tomcat.log
echo "--------------------------------------------" >>/var/log/tomcat.log

Stop
echo "This is Stop script ..."
java_home=/usr/jdk1.6.0_13;
Export Java_home
Jre_home= $JAVA _home/jre;
Export Jre_home
Export path= $PATH: $JAVA _home/bin
Export classpath=./: $JAVA _home/lib: $JAVA _home/jre/lib
Date + "%y-%m-%d%t:stoping tomcat ..." >>/var/log/tomcat.log
/software/apache-tomcat-6.0.32/bin/shutdown.sh >>/var/log/tomcat.log
Date + "%y-%m-%d%t:tomcat stoped ..." >>/var/log/tomcat.log
echo "--------------------------------------------" >>/var/log/tomcat.log

Restart)
echo "Here is restart script ..."
Date + "%y-%m-%d%T tomcat restart ..." >>/var/log/tomcat.log
$ stop
$ start

*)
echo "Usage: $ {Start|stop|restart}"
Exit 1
Esac
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: info-contact@alibabacloud.com 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.