需要将tomcat加入自启动队列中,则需要进行如下的操作:
以root用户登录系统:
cd /etc/rc.d/init.d/
vi tomcat
文件内容参考如下:
#!/bin/sh
#
# tomcat: Start/Stop/Restart tomcat
#
# chkconfig: 2345 80 20
# description: Tomcat is a Java Servlet Container
#
#
# match these values to your environment:
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_TMPDIR=/usr/local/tomcat/temp
export JRE_HOME=/usr/java/jdk15
# Source function library.
. /etc/rc.d/init.d/functions
TOMCAT=/usr/local/tomcat
start() {
echo -n ___FCKpd___0quot;Starting Tomcat: "
$TOMCAT/bin/catalina.sh start
}
stop() {
echo -n ___FCKpd___0quot;Stopping Tomcat: "
$TOMCAT/bin/catalina.sh stop
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
;;
status)
;;
restart)
stop
start
;;
*)
echo ___FCKpd___0quot;Usage: $0 {startstoprestart}"
;;
esac
exit $RETVAL
把 tomcat 修改为可运行的文件,命令参考如下:
chmod a+x tomcat
使用chkconfig命令把 tomcat 命令加入到系统启动队列中:
chkconfig --add tomcat
查看apachectl的状态:
chkconfig --list tomcat
好了,全部完成!
【Linux系统下设置Tomcat自启动】相关文章: