标签:
#!/bin/bash
set -x
FILE1=DyhWeb.war
FILE2=apacheactivemq.properties
FILE3=config.properties
FILE4=property.properties
DIR1=/usr/local/tomcat-8180/webapps/
DIR2=/usr/local/tomcat-8180/webapps/DyhWeb/WEB-INF/classes
DIR3=/usr/local/tomcat-8180/appBackup/
DATE=`date +%F%H%M`
if [ -d ${DIR1%w*}${FILE1%.*} ];then
rm -rf ${DIR1%w*}${FILE1%.*} && mkdir -p ${DIR1%w*}${FILE1%.*}
else
mkdir -p ${DIR1%w*}${FILE1%.*}
fi
if [ -f $FILE1 ];then
unzip $FILE1 -d ${DIR1%w*}${FILE1%.*} && mv ${DIR1}${FILE1%.*} ${DIR3}${FILE1%.*}.$DATE && mv ${DIR1%w*}${FILE1%.*} $DIR1
\cp -f ${DIR3}${FILE1%.*}.$DATE/WEB-INF/classes/apacheactivemq.properties $DIR2
\cp -f ${DIR3}${FILE1%.*}.$DATE/WEB-INF/classes/ config.properties $DIR2
\cp -f ${DIR3}${FILE1%.*}.$DATE/WEB-INF/classes/ property.properties $DIR2
${DIR1%w*}bin/catalina.sh stop && ps -ef | grep tomcat-8180 | grep -v "grep"
echo $?
if [ $? = 0 ];then
ps -ef | grep tomcat-8180|grep -v "grep" |awk ‘{print $2}‘ | xargs -i kill -9 {}
${DIR1%w*}bin/catalina.sh start && tail -f ${DIR1%w*}logs/catalina.out
else
${DIR1%w*}bin/catalina.sh start && tail -f ${DIR1%w*}logs/catalina.out
fi
else
exit
fi
标签:
原文地址:http://my.oschina.net/daquan/blog/487437