メモ:tomcatをroot以外で実行する


root権限が大きすぎてtomcatサービス起動スクリプトを変更
#vi /etc/rc.d/init.d/tomcat

 
#!/bin/bash

# chkconfig: 345 99 10

# description: Startup Script for tomcat

# /etc/rc.d/init.d/tomcat

#JDK Settings
export JAVA_HOME=/usr/java/jdk1.5.0_22
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/toos.jar
export PATH=$PATH:$JAVA_HOME/bin


case "$1" in

start)

echo "Starting tomcat: "
# cnfixit      
su -c /usr/local/tomcat5/bin/./startup.sh cnfixit 
echo "OK......tomcat started"

;;

stop)

echo "Shutdown tomcat: "
/usr/local/tomcat5/bin/./shutdown.sh

echo "OK.....tomcat stoped"

;;

*)

echo "Usage: 'basename $0' start|stop"

exit 1

esac

exit 0

 
[root@server ~]# ps -ef | grep tomcat
cnfixit   3237     1  3 08:25 ?        00:00:44 /usr/java/jdk1.5.0_22/bin/java -Djava.util.logging.config.file=/usr/local/tomcat5/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat5/common/endorsed -classpath /usr/local/tomcat5/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat5 -Dcatalina.home=/usr/local/tomcat5 -Djava.io.tmpdir=/usr/local/tomcat5/temp org.apache.catalina.startup.Bootstrap start
root      3369  3340  0 08:44 pts/0    00:00:00 grep tomcat
[root@server ~]#