• Linux下设置开机自启动Tomcat


     

    方法一:


    Linux 下tomcat开机自启动
    修改Tomcat/bin/startup.sh 为:
    export JAVA_HOME=/usr/Java/j2sdk1.4.2_08
    export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
    export PATH=$PATH:$JAVA_HOME/bin
    export CATALINA_HOME=/usr/local/tomcat
    /usr/local/tomcat/bin/catalina.sh start

    在/etc/rc.d/rc.local中加入:
    /usr/local/tomcat/bin/startup.sh

    方法二:

    1、把下面的代码保存为tomcat文件,并让它成为可执行文件 chmod 755 tomcat.
    #!/bin/bash
    #
    # kenny kenny.zhou@tom.com
    # /etc/rc.d/init.d/tomcat
    # init script for tomcat precesses
    #
    # processname: tomcat
    # description: tomcat is a j2se server
    # chkconfig: 2345 86 16
    # description: Start up the Tomcat servlet engine.

    if [ -f /etc/init.d/functions ]; then
    . /etc/init.d/functions
    elif [ -f /etc/rc.d/init.d/functions ]; then
    . /etc/rc.d/init.d/functions
    else
    echo -e "/atomcat: unable to locate functions lib. Cannot continue."
    exit -1
    fi

    RETVAL=$?
    CATALINA_HOME="/usr/local/tomcat"

    case "$1" in
    start)
    if [ -f $CATALINA_HOME/bin/startup.sh ];
    then
    echo $"Starting Tomcat"
    $CATALINA_HOME/bin/startup.sh
    fi
    ;;
    stop)
    if [ -f $CATALINA_HOME/bin/shutdown.sh ];
    then
    echo $"Stopping Tomcat"
    $CATALINA_HOME/bin/shutdown.sh
    fi
    ;;
    *)
    echo $"Usage: $0 {start|stop}"
    exit 1
    ;;
    esac

    exit $RETVAL

    2、将tomcat文件拷贝到/etc/init.d/下,并运行:chkconfig --add tomcat

    3、在tomcat/bin/catalina.sh文件中加入以下语句:
    export JAVA_HOME=/YOURPATH/tomcat/jdk
    export CATALINA_HOME=/YOURPATH/tomcat
    export CATALINA_BASE=/YOURPATH/tomcat
    export CATALINA_TMPDIR=/YOURPATH/tomcat/temp

    启动tomcat: service tomcat start
    停止tomcat: service tomcat stop   

  • 相关阅读:
    人月神话阅读笔记01
    第二周总结
    第一周总结
    软件工程课程总结
    FIR滤波器窗函数设计法详细步骤以及Matlab代码
    【转载】傅立叶变换、拉普拉斯变换、Z变换之间的联系?
    Matlab实现IIR数字滤波器设计
    数字信号滤波器的重要函数
    奇异谱分析
    字符串解码DecodeString
  • 原文地址:https://www.cnblogs.com/zhaogaojian/p/6539328.html
Copyright © 2020-2023  润新知