需要将tomcat加入自启动队列中,则需要进行如下的操作:
以root用户登录系统:
cd/etc/rc.d/init.d/
vitomcat
文件内容参考如下:
#!/bin/sh
#
#tomcat:Start/Stop/Restarttomcat
#
#chkconfig:23458020
#description:TomcatisaJavaServletContainer
#
#
#matchthesevaluestoyourenvironment:
exportCATALINA_BASE=/usr/local/tomcat
exportCATALINA_HOME=/usr/local/tomcat
exportCATALINA_TMPDIR=/usr/local/tomcat/temp
exportJRE_HOME=/usr/java/jdk15
#Sourcefunctionlibrary.
./etc/rc.d/init.d/functions
TOMCAT=/usr/local/tomcat
start(){
echo-n___FCKpd___0quot;StartingTomcat:"
$TOMCAT/bin/catalina.shstart
}
stop(){
echo-n___FCKpd___0quot;StoppingTomcat:"
$TOMCAT/bin/catalina.shstop
}
#Seehowwewerecalled.
case"$1"in
start)
start
;;
stop)
stop
;;
status)
;;
status)
;;
restart)
stop
start
;;
*)
echo___FCKpd___0quot;Usage:$0{start stop restart}"
;;
esac
exit$RETVAL
把tomcat修改为可运行的文件,命令参考如下:
chmoda+xtomcat
使用chkconfig命令把tomcat命令加入到系统启动队列中:
chkconfig--addtomcat
查看apachectl的状态:
chkconfig--listtomcat
好了,全部完成!