随笔-62  评论-29  文章-0  trackbacks-0
 

如配置tomcatLinux启动服务

1:编写启动服务的文件tomcat ,然后加入到/etc/rc.d/init.d目录中

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=/work/tomcat5

export CATALINA_HOME=/work/tomcat5

export CATALINA_TMPDIR=/work/tomcat5/temp

export JRE_HOME=/usr/java/jdk1.5.0_14

# Source function library.

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

TOMCAT=/work/tomcat5

start() {

echo -n $"Starting Tomcat: "

$TOMCAT/bin/catalina.sh start

}

stop() {

echo -n $"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 $"Usage: $0 {start|stop|restart}"

;;

esac

exit $RETVAL

2:添加tomcat到服务中

#chkconfig --add tomcat

#chkconfig --list tomcat

#chkconfig --del tomcat

3:重启机器便可启动tomcat

4:设置登陆启动

/etc/profile

中加入要启动的程序,便可在用户登录的时候启动

5:设置开机启动

/etc/rc.d/rc.local文件中,加入要启动的程序,便可在用户开机的时候启动



posted on 2009-01-16 09:58 阅读(3153) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: