tomcat 开机自启方法
1.把下面的代码保存为tomcat文件,并让它成为可执行文件 chmod 755 tomcat.
#!/bin/bash # # /etc/rc.d/init.d/tomcat # init script for tomcat precesses # # processname: tomcat # description: tomcat is a j2ee server # chkconfig: 2345 86 16 # description: Start up the Tomcat servlet engine. CATALINA_HOME="/usr/local/convert/tomcat" case "$1" in start) if [ -f $CATALINA_HOME/bin/catalina.sh ]; then echo $"Starting Tomcat" $CATALINA_HOME/bin/catalina.sh start fi ;; stop) if [ -f $CATALINA_HOME/bin/catalina.sh ]; then echo $"Stopping Tomcat" $CATALINA_HOME/bin/catalina.sh stop fi ;; *) echo $"Usage: $0 {start|stop}" exit 1 ;; esac
2.将tomcat文件拷贝到/etc/init.d/下,并运行:chkconfig --add tomcat
3.编辑catalina.sh 在前面加入以下语句
export JAVA_HOME=/usr/local/convert/java export CATALINA_HOME=/usr/local/convert/tomcat export CATALINA_BASE=/usr/local/convert/tomcat export CATALINA_TMPDIR=/usr/local/convet/tomcat/temp