#!/bin/sh
Curl=$1
Crootdir=/data/tomcat/tomcat-usercenter
Shrootdir=/data/tomcat/dll
#delete old version
RM-RF $shRootDir/usercenter-web.war*
#默认war包地址为jenkins上最后一次打包成功的url
if [$cURL = 0]
Then
curl=http://192.168.2.239:9000/view/development/job/dev-usercenter-branches/lastsuccessfulbuild/artifact/ Usercenter-web/target/usercenter-web.war
Fi
echo "--------------get War and deploy------------"
cpid=$ (ps-ef |grep Tomcat-[user]|awk ' {print $} ')
Kill-9 $cpid
CD $shRootDir
wget $cURL
Sleep 10
CD $cRootDir
RM-RF webapps/* work/* logs/*
CP $shRootDir/usercenter-web.war $cRootDir/webapps/
$cRootDir/bin/startup.sh >>/dev/temp
Sleep 10
echo "--------------change Dimaond.property------------"
cpid=$ (ps-ef |grep Tomcat-[user]|awk ' {print $} ')
Kill-9 $cpid
CD $cRootDir/webapps/usercenter-web/web-inf/classes/spring
Sed-i "S/production/test/g" diamond.properties
#修改jar包的文件, first unzip with unzip, then replace the file with zip separately
echo "---------------Change Memcached.xml--------------"
CD $cRootDir/webapps/usercenter-web/web-inf/lib
Unzip usercenter-biz-service-impl-1.0.0.jar-d Usercenter
Sleep 2
Sed-i "s/192.168.59.69:5005/192.168.2.200:11211/g"./usercenter/memcached.xml
CP./usercenter/memcached.xml./memcached.xml
Zip-m Usercenter-biz-service-impl-1.0.0.jar./memcached.xml
RM-RF Usercenter
echo "--------------start tomcat------------"
$cRootDir/bin/startup.sh
TAILF $cRootDir/logs/catalina.out
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Shell-automatically deploy the war package to Tomcat