1. 程式人生 > >shell編寫自動化釋出指令碼

shell編寫自動化釋出指令碼

##在此之前先把專案從網上克隆下來,比如從碼雲上clone到git-repository/HAHA


echo "*********************進入git專案HAHA目錄*******************************"
cd /developer/git-repository/HAHA


echo "*********************git切換分支到v1.0***********************"
git checkout v1.0


echo "*********************git fetch*************************************"
git fetch


echo "*********************git  pull***********************"
git pull


echo "*********************編譯並跳過單元測試***********************"
mvn clean package -Dmaven.test.skip=true


echo "*********************刪除舊的ROOT.war***********************"
rm /developer/apache-tomcat-7.0.73/webapps/ROOT.war


echo "*********************拷貝編譯出來的war包到tomcat下-ROOT.war*************"
cp /developer/git-repository/wulijian/target/app.war    /developer/apache-tomcat-7.0.73/webapps/ROOT.war


echo "*********************刪除tomcat下的舊的ROOT資料夾***********************"
rm -rf /developer/apache-tomcat-7.0.73/webapps/ROOT

echo "*********************關閉tomcat***********************"
/developer/apache-tomcat-7.0.73/bin/shutdown.sh


echo "*********************睡眠10秒***********************"
for i in {1..10}
do
echo $i"s"
sleep 1s
done


echo "*********************啟動tomcat***********************"
/developer/apache-tomcat-7.0.73/bin/startup.sh