开机自动启动tomcat(添加到启动服务组)
(1)首先进入/usr/local/tomcat/bin目录,安装jsvc
tar zxvf jsvc.tar.gz
cd jsvc-src
chmod +x configure
./configure -with-java=/usr/java/jdk1.6.0_02
make
cp jsvc ..
(2)增加普通用户
#useradd tomcat6 添加用户
#groupadd tomcat 添加组
#usermod -G tomcat tomcat6 把tomcat6加入tomcat组
#chown -R tomcat6 /usr/local/tomcat 设置用户tomcat6对tomcat的权限
(3)vim /etc/init.d/tomcat6
加入如下内容
#!/bin/sh
#
# Startup Script for Tomcat5
#
# chkconfig: 345 88 14
# description: Tomcat Daemon
# processname: jsvc
# pidfile: /var/run/jsvc.pid
# config:
#
# Source function library.
. /etc/rc.d/init.d/functions
#
prog=tomcat6
#
JAVA_HOME=/usr/java/jdk1.6.0_02
CATALINA_HOME=/usr/local/tomcat
DAEMON_HOME=$CATALINA_HOME/bin/jsvc
TOMCAT_USER=tomcat6
TMP_DIR=/var/tmp
CATALINA_OPTS=
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
RETVAL=0
prog="tomcat6"
case "$1" in
start)
#
# Start Tomcat
#
$CATALINA_HOME/bin/jsvc \
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$TMP_DIR \
-outfile $CATALINA_HOME/logs/catalina.out \