欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

linux自动重启tomcat脚本分享

程序员文章站 2023-11-27 20:54:46
复制代码 代码如下:#!/bin/bash##chkconfig: 35 88 14#description: tomcat auto start script#scrip...
复制代码 代码如下:

#!/bin/bash
#
#chkconfig: 35 88 14
#description: tomcat auto start script
#script by okhelper
case "$1" 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 "here 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
$0 stop
$0 start

*)
echo "usage: $0 {start|stop|restart}"
exit 1
esac