首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

linux下登记tomcat的服务

2012-06-26 
linux下注册tomcat的服务1.在/etc/rc.d/init.d中建脚本tomcatd.chmod +x tomcatd2.chkconfig --add tomcat

linux下注册tomcat的服务
1.在/etc/rc.d/init.d中建脚本tomcatd.
chmod +x tomcatd
2.chkconfig --add tomcatd就可以用service tomcatd start/stop/rstart了
附:脚本(我也是抄的,呵呵)

#!/bin/sh## Startup script for Tomcat, the Apache Servlet Engine## chkconfig: 345 80 20# description: Tomcat is the Apache Servlet Engine# processname: tomcat# pidfile: /var/run/tomcat.pid## Mike Millson <mmillson@meritonlinesystems.com>;## version 1.02 - Clear work directory on shutdown per John Turner suggestion.# version 1.01 - Cross between Red Hat Tomcat RPM and Chris Bush scripts# Tomcat name :)TOMCAT_PROG=tomcat# if TOMCAT_USER is not set, use tomcat like Apache HTTP serverif [ -z "$TOMCAT_USER" ]; thenTOMCAT_USER="root"fiRETVAL=0# start and stop functionsstart() {    echo -n "Starting tomcat: "    chown -R $TOMCAT_USER:$TOMCAT_USER /usr/local/tomcat/*       su -l $TOMCAT_USER -c '/usr/local/tomcat/bin/startup.sh'    RETVAL=$?    echo    [ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat    return $RETVAL}stop() {    echo -n "Stopping tomcat: "    su -l $TOMCAT_USER -c '/usr/local/tomcat/bin/shutdown.sh'    RETVAL=$?    echo    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat /var/run/tomcat.pid       rm -rf /usr/local/tomcat/work/*}# See how we were called.case "$1" in  start)        start        ;;  stop)        stop        ;;  restart)        stop        # Ugly hack        # We should really make sure tomcat        # is stopped before leaving stop        sleep 2               start        ;;  *)        echo "Usage: $0 {start|stop|restart}"        exit 1esacexit $RETVAL

热点排行