tomcat单机多实例 supervisord管理 脚本

iamplane 2020-01-16

#!/bin/bash

systemctl stop firewalld
setenforce 0
setenforce 0
yum -y install epel-release
yum -y install supervisor
touch /etc/supervisord.d/tomcat.ini
echo > /etc/supervisord.d/tomcat.ini
java -version > /dev/null
if [ $? -ne 0 ];then
        cd /opt/
        rpm -ivh jdk-8u131-linux-x64_.rpm
fi
mkdir /opt/tomcat
for i in `seq 1 3`
do
        c8009=`expr 8009 + $i `
        c8005=`expr 8005 + $i `
        c8080=`expr 8080 + $i `
        mkdir /opt/tomcat/tomcat$i
        cd /opt/
        tar -zxvf apache-tomcat-8.5.35.tar.gz
        mv apache-tomcat-8.5.35 /opt/tomcat/tomcat$i/apache-tomcat-8.5.35
        cd /opt/tomcat/tomcat$i/apache-tomcat-8.5.35/conf
        sed -i "s#8009#$c8009#g" server.xml
        sed -i "s#8080#$c8080#g" server.xml
        sed -i "s#8005#$c8085#g" server.xml
        cat >>/etc/supervisord.d/tomcat.ini<<EOF
        [program:tomcat$i]
        command=/opt/tomcat/tomcat$i/apache-tomcat-8.5.35/bin/catalina.sh run
EOF
done
supervisord -n

 

相关推荐

Sophisticated / 0评论 2019-06-29