| 導購 | 订阅 | 在线投稿
分享
 
 
 

Linux操作系統下Tomcat自啓動的設置技巧

來源:互聯網  2008-07-01 06:56:37  評論

安裝了Tomcat,很簡單,將下載下來的安裝文件包解壓,放入相應的目錄中,然後在Linux環境中設置相應的如:JAVA_HOME、CATALINA_HOME等環境變量後,在Tomcat的bin目錄下執行./catalina.sh run就能在終端方式上啓動tomcat的服務。如果需要將tomcat加入自啓動隊列中,則需要進行如下的操作:

以root用戶登錄系統:

cd /etc/rc.d/init.d/

vi tomcat

文件內容參考如下:

#!/bin/sh

#

# tomcat: Start/Stop/Restart tomcat

#

# chkconfig: 2345 80 20

# description: Tomcat is a Java Servlet Container

#

#

# match these values to your environment:

export CATALINA_BASE=/usr/local/tomcat

export CATALINA_HOME=/usr/local/tomcat

export CATALINA_TMPDIR=/usr/local/tomcat/temp

export JRE_HOME=/usr/java/jdk15

# Source function library.

. /etc/rc.d/init.d/functions

TOMCAT=/usr/local/tomcat

start() {

echo -n ___FCKpd___0quot;Starting Tomcat: "

$TOMCAT/bin/catalina.sh start

}

stop() {

echo -n ___FCKpd___0quot;Stopping Tomcat: "

$TOMCAT/bin/catalina.sh stop

}

# See how we were called.

case "$1" in

start)

start

;;

stop)

stop

;;

status)

;;

status)

;;

restart)

stop

start

;;

*)

echo ___FCKpd___0quot;Usage: $0 {startstoprestart}"

;;

esac

exit $RETVAL

把 tomcat 修改爲可運行的文件,命令參考如下:

chmod a+x tomcat

使用chkconfig命令把 tomcat 命令加入到系統啓動隊列中:

chkconfig --add tomcat

查看apachectl的狀態:

chkconfig --list tomcat

好了,全部完成!

安裝了Tomcat,很簡單,將下載下來的安裝文件包解壓,放入相應的目錄中,然後在Linux環境中設置相應的如:JAVA_HOME、CATALINA_HOME等環境變量後,在Tomcat的bin目錄下執行./catalina.sh run就能在終端方式上啓動tomcat的服務。如果需要將tomcat加入自啓動隊列中,則需要進行如下的操作: 以root用戶登錄系統: cd /etc/rc.d/init.d/ vi tomcat 文件內容參考如下:   #!/bin/sh   #   # tomcat: Start/Stop/Restart tomcat   #   # chkconfig: 2345 80 20   # description: Tomcat is a Java Servlet Container   #   #   # match these values to your environment:   export CATALINA_BASE=/usr/local/tomcat   export CATALINA_HOME=/usr/local/tomcat   export CATALINA_TMPDIR=/usr/local/tomcat/temp   export JRE_HOME=/usr/java/jdk15   # Source function library.   . /etc/rc.d/init.d/functions   TOMCAT=/usr/local/tomcat   start() {   echo -n ___FCKpd___0quot;Starting Tomcat: "   $TOMCAT/bin/catalina.sh start   }   stop() {   echo -n ___FCKpd___0quot;Stopping Tomcat: "   $TOMCAT/bin/catalina.sh stop   }   # See how we were called.   case "$1" in   start)   start   ;;   stop)   stop   ;;   status)   ;;   status)   ;;   restart)   stop   start   ;;   *)   echo ___FCKpd___0quot;Usage: $0 {start stop restart}"   ;;   esac   exit $RETVAL 把 tomcat 修改爲可運行的文件,命令參考如下: chmod a+x tomcat 使用chkconfig命令把 tomcat 命令加入到系統啓動隊列中: chkconfig --add tomcat 查看apachectl的狀態: chkconfig --list tomcat 好了,全部完成!
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有