在ubuntu下面,我们安装tomcat可以有两种方式 [1]用aptitude安装 aptitude install tomcat6 [2]免安装版 从apache tomcat 网站下载apache-tomcat-6.0.20 然后直接解压 第一种方式,可以用/etc/init.d/tomcat6实现对tomcat的启动和关闭 那么第二种方式呢,就只能 cd /opt/apache-tomcat-6.0.20,然后 bin/startup.sh来启动,用bin/shutdown.sh来关闭。麻烦在于你每次都需要先进入目录,才能启动和关闭。 一个简便的方式,可以如下实现和第一种方式一样的结果。 其实很简单。 cd /zy/green/apache-tomcat-6.0.20/ #./bin/startup.sh case "$1" in start) ./bin/startup.sh exit 1;; stop) ./bin/shutdown.sh exit 1;; esac 保存成文件/etc/init.d/tomcat 然后,你就可以用/etc/init.d/start来启动你的tomcat了,也可以用/etc/init.d/tomcat来关闭你的tomcat了。 |
|