tomcat安装成系统服务:
vi /etc/init.d/tomcat
Bash代码
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 2345 10 90
JAVA_HOME=/usr/java/jdk1.6.0_30
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-6.0.35
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0
:wq
上面“# chkconfig: 2345 10 90 ”的意思是《2345是设为要启动的运行级别,10是启动优先级,90是杀死进程的优先级,谁优先谁先挂的意思。》
chmod 755 tomcat
chkconfig --add tomcat
chkconfig --level 2345 tomcat on
chkconfig --list tomcat