[Linux Jee] Linux部署多个实例的分布式程序时的目录结构

来源:互联网 发布:数据访问框架 编辑:程序博客网 时间:2024/06/09 20:21
目录结构统一如下:
/lc_iims/tomcat/IIMS/apache-tomcat-6.0.32
/lc_iims/tomcat/CA/apache-tomcat-6.0.32
/lc_iims/tomcat/Crawl端口1/apache-tomcat-6.0.32
/lc_iims/tomcat/Crawl端口n/apache-tomcat-6.0.32
/lc_iims/tomcat/IFA端口1/apache-tomcat-6.0.32
/lc_iims/tomcat/IFA端口n/apache-tomcat-6.0.32

/lc_iims/webApps/IIMS
/lc_iims/webApps/CA
/lc_iims/webApps/Crawl
/lc_iims/webApps/IFA

/lc_iims/properties/Crawl端口1/*.properties、log4j等配置文件
/lc_iims/properties/Crawl端口n/*.properties、log4j等配置文件
/lc_iims/properties/IFA端口1/*.properties、log4j等配置文件
/lc_iims/properties/IFA端口n/*.properties、log4j等配置文件


/lc_iims/logs/IIMS/iims.log
/lc_iims/logs/CA/CA.log
/lc_iims/logs/Crawl端口1/Crawl.log
/lc_iims/logs/Crawl端口n/Crawl.log
/lc_iims/logs/IFA端口1/IFA.log
/lc_iims/logs/IFA端口n/IFA.log

启动和关闭Tomcat 的脚本:  放在/lc_iims 目录下
启动脚本:
#! /bin/sh
appBase=`pwd`
echo ${appBase}


for filename in `ls ${appBase}/tomcat`
        do
                appBinPath="${appBase}/tomcat/${filename}/apache-tomcat-6.0.32/bin/"
                if [ -d ${appBinPath} ]
                then
                        echo "Run ${appBinPath}startup.sh"
                        sh ${appBinPath}startup.sh
                fi
        done


关闭脚本:
#! /bin/sh
appBase=`pwd`
echo "your appBase path is ${appBase}"
if [ -d "${appBase}/tomcat" ]
then
        #Crawl
        if [ `ps -ef | grep "${appBase}/tomcat/" | grep -v "grep" | wc -l` -gt 0 ]
        then
                ps -ef | grep ${appBase}/tomcat/ | grep -v "grep" | awk '{print $2}'| xargs kill -9
        else
                echo "grep ${appBase}/tomcat is null."
                echo "your process no start."
        fi
else
        echo "Sorry, please put this file into right appBase path"
        echo "eg: /lc_iims/"
fi

if [ `ps -ef | grep "${appBase}/tomcat/" | grep -v "grep" | wc -l` -eq 0 ]; then
        echo "Stop Success...!"
else
        echo "Stop Failed!!!"
fi

原创粉丝点击