zoukankan      html  css  js  c++  java
  • tomcat安装部署完整过程

    1.tomcat安装脚本(installTomcat.sh含开机自启动)

    #!/bin/sh
    
    #定义变量
    basePath=$(cd `dirname $0`;pwd)
    releasePath=/usr/local/jenkins
    echo "$basePath"
    echo "$releasePath"
    
    mkdir -pv $releasePath
    
    function installJDK(){
        echo "install oracleJDK……"
        tar -zxf jdk-8u251-linux-x64.tar.gz
        mv jdk1.8.0_251 $releasePath/jdk1.8.0_251
        echo "orcalejdk1.8.0_251 installed: ok"
    }
    function jenkins_install(){
        sed "$a JENKINS_HOME=/jenkins" /etc/profile
    }
    
    function installTomcat(){
        echo "install Tomcat……"
        tar -zxf apache-tomcat-8.5.59.tar.gz
        mv apache-tomcat-8.5.59 $releasePath/tomcat    
        
        #添加强制关闭tomcat参数配置
        #sed -i '/"$EXECUTABLE" stop/s#exec "$PRGDIR"/"$EXECUTABLE" stop "$@"#exec "$PRGDIR"/"$EXECUTABLE" stop -force "$@"#' $releasePath/tomcat/bin/shutdown.sh
        #在catalina.sh中添加tomcat的安装路径
        sed -i "203iexport CATALINA_BASE=$releasePath/tomcat"  $releasePath/tomcat/bin/catalina.sh
        sed -i "204iexport CATALINA_HOME=$releasePath/tomcat"  $releasePath/tomcat/bin/catalina.sh
        sed -i "205iexport CATALINA_TMPDIR=$releasePath/tomcat"  $releasePath/tomcat/bin/catalina.sh
        #在setclasspath.sh中指定使用的jdk路径
        sed -i "23iexport JAVA_HOME=$releasePath/jdk1.8.0_251" /$releasePath/tomcat/bin/setclasspath.sh
        sed -i "24iexport JRE_HOME=$releasePath/jdk1.8.0_251/jre" /$releasePath/tomcat/bin/setclasspath.sh
        sed -i "25iexport CLASSPATH=.:$releasePath/jdk1.8.0_251/lib/dt.jar:$releasePath/jdk1.8.0_251/lib/tools.jar" /$releasePath/tomcat/bin/setclasspath.sh
        echo "tomcat installed: ok"
        #配置tomcat开机自启
        cp $basePath/restartTomcat.sh /$releasePath/tomcat/bin
        ln -sf $releasePath/tomcat/bin/restartTomcat.sh /etc/rc.d/init.d/tomcat
        chmod +x /etc/rc.d/init.d/tomcat
        chkconfig --list
        cd /etc/rc.d/init.d
        chkconfig --add tomcat
        chkconfig --list tomcat
        #开放tommcat端口
        firewall-cmd --zone=public --add-port=8080/tcp --permanent
        firewall-cmd --reload
        firewall-cmd --list-all | grep ports
        #启动tomcat
        systemctl start tomcat
        
    }
    
    
    
    if [ ! -d $releasePath/jdk1.8.0_251 ];then
        installJDK
    fi
    
    if [ ! -d $releasePath/tomcat ];then
        installTomcat
    fi
    
    if [ "$(cat /etc/profile | grep JENKINS_HOME)" = "JENKINS_HOME=/jenkins" ];then
        echo "已配置jenkins环境变量"
        source /etc/profile
    else
        echo "JENKINS_HOME=/jenkins" >> /etc/profile
        source /etc/profile
    fi

    2.tomcat开机启动脚本(restartTomcat.sh)

    #!/bin/sh
    # chkconfig: 2345 80 90
    # description: tomcat auto start
    # processname:tomcat8.5.89
    
    releasePath=$(cd /usr/local/jenkins/tomcat;pwd)
    
    source /etc/profile
    #重启tomcat
    cd  $releasePath/bin
    sh shutdown.sh
    sh startup.sh

    3.存档跟踪:

  • 相关阅读:
    深度可分离卷积、分组卷积、空洞卷积、转置卷积
    Batch Normalization
    激活函数
    容器————vector
    39XML文档类
    38初识xml
    37QT程序打包
    36可视化操作数据库
    35使用模型操作数据库
    34sqlite
  • 原文地址:https://www.cnblogs.com/schblog/p/13983219.html
Copyright © 2011-2022 走看看