1.需要在/etc/init.d下面新建tomcat启动脚本
#!/bin/sh
#tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/opt/jdk18025
case $1 in
start)
sh /opt/tomcat7/bin/startup.sh
;;
stop)
sh /opt/tomcat7/bin/shutdown.sh
;;
restart)
sh /opt/tomcat7/bin/shutdown.sh
sh /opt/tomcat7/bin/startup.sh
;;
*)
echo ‘Usage:tomcat start|stop|restart’
;;
esac
exit 0
- sysv-rc-conf tomcat on
也可以使用
Java代码
- update-rc.d tomcat6 defaults
- update-rc.d tomcat6 remove