#!/bin/bash
DATE=`date +%F-%H-%M`
PROJECT='appname'
PROJECT_TARGET='appname-target'
ROOTDIR='/usr/local'
TOMCAT_HOME='/usr/local/tomcat-01'
echo '停止tomcat-01'
sh ${TOMCAT_HOME}/bin/shutdown.sh
ps -ef | grep ${TOMCAT_HOME}/ | grep -v grep| awk '{print $2}' | xargs kill -9
cp ${ROOTDIR}/test_env_update_war/${PROJECT}.war ${ROOTDIR}/test_war_backup/test-${PROJECT}-${DATE}.war
rm -rf ${TOMCAT_HOME}/webapps/${PROJECT_TARGET}.war
rm -rf ${TOMCAT_HOME}/webapps/${PROJECT_TARGET}
mv ${ROOTDIR}/test_env_update_war/${PROJECT}.war ${TOMCAT_HOME}/webapps/${PROJECT_TARGET}.war
echo '启动test-tomcat-01'
sh ${TOMCAT_HOME}/bin/startup.sh