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