• Tomcat 在 Linux 下的自动启动脚本


    很多服务都需要设置为开机自启动。将下面代码复制到 /etc/rc.d/init.d/tomcat ,然后执行 

    chkconfig –add tomcat 
    chkconfig tomcat on 
    就可以 
    service tomcat start 

    附上代码:

    #!/bin/bash
    #
    # Startup script for Tomcat
    #
    # chkconfig: 345 84 16
    # description: Tomcat jakarta JSP server
    TOMCAT_HOME=/usr/share/apache-tomcat-5.5.20
    TOMCAT_START=$TOMCAT_HOME/bin/startup.sh
    TOMCAT_STOP=$TOMCAT_HOME/bin/shutdown.sh
    #Necessary environment variables
    export JAVA_HOME=”/usr/share/jdk1.5.0_10?
    export CATALINA_HOME=”/usr/share/apache-tomcat-5.5.20?
    #export LD_KERNEL_ASSUME=”2.2.5?
    # Source function library.
    . /etc/rc.d/init.d/functions
    # Source networking configuration.
    . /etc/sysconfig/network
    # Check that networking is up.
    [ ${NETWORKING} = “no” ] && exit 0
    #Check for tomcat script
    if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
    then
        echo “Tomcat not available…”
        exit
    fi
    start() {
        echo -n “Starting Tomcat: “
        su - tomcat -c $TOMCAT_START
        echo
        touch /var/lock/subsys/tomcatd
    # We may need to sleep here so it will be up for apache
        sleep 3
    #Instead should check to see if apache is up by looking for httpd.pid
    }
    stop() {
        echo -n $”Shutting down Tomcat: “
        su - tomcat -c $TOMCAT_STOP
        rm -f /var/lock/subsys/tomcatd
        echo
    }
    status() {
        ps ax –width=1000 | grep “[o]rg.apache.catalina.startup.Bootstrap start” | awk ‘{printf $1 ” “}’ | wc | awk ‘{print $2}’ > /tmp/tomcat_process_count.txt
       read line
  • 相关阅读:
    转发 微博 Qzone 微信 草根创业英雄时代落幕:贾跃亭戴威们一去不复返
    python 发送大Json格式数据
    python post json数据
    python post 参数
    IntelliJ Idea 常用10款插件(提高开发效率)
    IDEA操作技巧:一些常用且实用的插件
    nacos
    Sentinel 与 Hystrix 的对比
    阿里启动新项目:Nacos,比 Eureka 更强!
    D3.js学习(一)
  • 原文地址:https://www.cnblogs.com/hd-zg/p/4932821.html
Copyright © 2020-2023  润新知