export JAVA_HOME=/usr/jdk /usr/local/apache-tomcat-7.0.26/tomcat/bin/startup.sh
------解决方案-------------------- chkconfig service on
------解决方案--------------------
------解决方案-------------------- 首先为Tomcat编辑一段启动脚本,并置于/etc/rc.d/init.d目录下,让Tomcat和httpd一样作为一项系统服务,并随系统自动启动。 vi /etc/rc.d/init.d/tomcat //添加以下脚本 #!/bin/bash## Startup script for the tomcat## chkconfig: 345 80 15# description: Tomcat is a Servlet+JSP Engine. export JDK_HOME=/usr/java/jdk1.6.0_26 export JAVA_HOME=/usr/java/jdk1.6.0_26 # Source function library. ./etc/rc.d/init.d/functions start(){ if [ -z $(/sbin/pidof java) ]; then echo "Starting tomcat" /usr/local/tomcat/bin/startup.sh touch /var/lock/subsys/tomcat else echo "tomcat allready running" fi } stop(){ if [ ! -z $(/sbin/pidof java) ]; then echo "Shutting down tomcat" /usr/local/tomcat/bin/shutdown.sh until [ -z $(/sbin/pidof java) ]; do :; done rm -f /var/lock/subsys/tomcat else echo "tomcat not running" fi} case "$1" in start) start ;; stop) stop ;; restart) stopstart ;; status) /usr/local/tomcat/bin/catalina.sh version ;; *) echo "Usage: $0 {start|stop|restart|status}" esac exit 0