CentOS下Tomcat开机启动脚本
时间:2014-12-16 14:00 来源:linux.it.net.cn 作者:IT
#!/bin/bash
#
# Startup script for the tomcat
#
# chkconfig: 345 80 15
# description: Tomcat is a Servlet+JSP Engine.
# Declare the tomcat installation directory.
TOMCAT_SERVER_PATH=/usr/local/www/tomcat7_test
# Declare the jdk installation directory.
export JAVA_HOME=/usr/java/jdk1.7.0_45
export JAVA_JRE=/usr/java/jdk1.7.0_45/jre
# Source function library.
. /etc/rc.d/init.d/functions
start() {
if [ -z $(/sbin/pidof java) ] ; then
echo "Starting tomcat..."
$TOMCAT_SERVER_PATH/bin/startup.sh
touch /var/lock/subsys/tomcat
else
echo "Tomcat has already been running..."
fi
}
stop() {
if [ ! -z $(/sbin/pidof java) ] ; then
echo "Shutting down tomcat..."
$TOMCAT_SERVER_PATH/bin/shutdown.sh
until [ -z $(/sbin/pidof java) ] ; do :; done
rm -f /var/lock/subsys/tomcat
else
echo "Tomcat has not been running..."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
$TOMCAT_SERVER_PATH/bin/catalina.sh version
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
exit 0
(责任编辑:IT)
#!/bin/bash # # Startup script for the tomcat # # chkconfig: 345 80 15 # description: Tomcat is a Servlet+JSP Engine. # Declare the tomcat installation directory. TOMCAT_SERVER_PATH=/usr/local/www/tomcat7_test # Declare the jdk installation directory. export JAVA_HOME=/usr/java/jdk1.7.0_45 export JAVA_JRE=/usr/java/jdk1.7.0_45/jre # Source function library. . /etc/rc.d/init.d/functions start() { if [ -z $(/sbin/pidof java) ] ; then echo "Starting tomcat..." $TOMCAT_SERVER_PATH/bin/startup.sh touch /var/lock/subsys/tomcat else echo "Tomcat has already been running..." fi } stop() { if [ ! -z $(/sbin/pidof java) ] ; then echo "Shutting down tomcat..." $TOMCAT_SERVER_PATH/bin/shutdown.sh until [ -z $(/sbin/pidof java) ] ; do :; done rm -f /var/lock/subsys/tomcat else echo "Tomcat has not been running..." fi } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) $TOMCAT_SERVER_PATH/bin/catalina.sh version ;; *) echo "Usage: $0 {start|stop|restart|status}" esac exit 0 (责任编辑:IT) |