tomcat启动脚本

Posted 花未全开月未圆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat启动脚本相关的知识,希望对你有一定的参考价值。

#!/bin/sh
# chkconfig: 345 99 10
# description: Auto-starts tomcat
# /etc/init.d/tomcatd
# Tomcat auto-start
# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network
RETVAL=0
export JAVA_HOME=/usr/java/jdk1.6.0_32/
export JRE_HOME=/usr/java/jdk1.6.0_32/jre
export CATALINA_HOME=/root/TRS/TRSWAS5.0/Tomcat
export CATALINA_BASE=/root/TRS/TRSWAS5.0/Tomcat
start()
{
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
RETVAL=$?
echo " OK"
return $RETVAL
fi
}
stop()
{
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
RETVAL=$?
sleep 1
ps -fwwu root | grep tomcat|grep -v grep | grep -v PID | awk ‘{print $2}‘|xargs kill -9
echo " OK"
# [ $RETVAL -eq 0 ] && rm -f /var/lock/...
return $RETVAL
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;

restart)
echo $"Restaring Tomcat"
$0 stop
sleep 1
$0 start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL




























































以上是关于tomcat启动脚本的主要内容,如果未能解决你的问题,请参考以下文章

tomcat多实例启动和关闭脚本

SSH远程执行脚本tomcat未启动

Tomcat启动脚本

shell脚本同时启动关闭多个tomcat

tomcat 启动脚本走过的坑

Centos开机自动执行shell脚本启动tomcat服务器