[size=large][color=darkred][b]Ubuntu 中的tomcat自启动方法[/b][/color][/size]
创建tomcat自启动文件:
[quote]sudo touch /etc/init.d/tomcat6[/quote]
在文件中加入如下代码:
其中JAVA_HOME 和CATALINA_HOME指向tomcat和jdk的路径
然后执行一下命令
[quote]sudo chmod 755 /etc/init.d/tomcat6[/quote]
最后执行:
[quote]sudo ln -s /etc/init.d/tomcat6 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat6/etc/rc2.d/S99tomcat
sudo /etc/init.d/tomcat6 start[/quote]
到此你的tomcat已经启动!
输入 [quote]ps -ef |grep java [/quote]看一下吧!
本文参考:[url]http://marshal.easymorse.com/archives/1198[/url]
[url]http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/[/url]
创建tomcat自启动文件:
[quote]sudo touch /etc/init.d/tomcat6[/quote]
在文件中加入如下代码:
#!/bin/bash
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export CATALINA_HOME=/srv/apache-tomcat
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
其中JAVA_HOME 和CATALINA_HOME指向tomcat和jdk的路径
然后执行一下命令
[quote]sudo chmod 755 /etc/init.d/tomcat6[/quote]
最后执行:
[quote]sudo ln -s /etc/init.d/tomcat6 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat6/etc/rc2.d/S99tomcat
sudo /etc/init.d/tomcat6 start[/quote]
到此你的tomcat已经启动!
输入 [quote]ps -ef |grep java [/quote]看一下吧!
本文参考:[url]http://marshal.easymorse.com/archives/1198[/url]
[url]http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/[/url]