zoukankan      html  css  js  c++  java
  • tomcat自启动脚本

    1、#cd /etc/rc.d/init.d
    2、#vi tomcat
    3、把下面的代码保存为tomcat文件,并让它成为可执行文件 chmod 755 tomcat.

    #!/bin/sh
    #
    # /etc/rc.d/init.d/tomcat
    # init script for tomcat precesses
    #
    # processname: tomcat
    # description: tomcat is a j2ee 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/apache-tomcat-8.0.11"

    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

    4、运行:chkconfig --add tomcat
    5、chmod 755 -R /etc/rc.d/init.d/tomcat

    6、在tomcat/bin/catalina.sh文件中的前面加入以下语句:

    export JAVA_HOME=/usr/java/jdk1.7.0_67
    export CATALINA_HOME=/usr/local/apache-tomcat-8.0.11
    export CATALINA_BASE=/usr/local/apache-tomcat-8.0.11
    export CATALINA_TMPDIR=/usr/local/apache-tomcat-8.0.11/temp

    测试tomcat能不能启动 启动tomcat: service tomcat start
    测试tomcat能不能停止 停止tomcat: service tomcat stop

    启动方式中该服务是启动 #chkconfig tomcat on  
    #chkconfig --list tomcat

  • 相关阅读:
    配置ssh免密登录
    idea打开项目定位到选择项目的位置
    MySQL decimal、numeric数据类型介绍
    C++ string::size_type类型
    Java Oracle存储过程问题
    PLSQL Developer简单使用教程
    ed2k如何下载
    老毛桃U盘启动盘制作工具安装教程
    Hibernate current_session_context_class的事务说明
    java openSession和getCurrentSession的比较
  • 原文地址:https://www.cnblogs.com/wangchunniu1314/p/6340021.html
Copyright © 2011-2022 走看看