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

你可能感兴趣的:(shell)