cd /mnt/jfinalgit/web echo "############## 进入 /mnt/jfinalgit/web 目录 ##############" rm -rf * rm -rf .* git clone git**********.git echo "############## git拉取完毕,开始打包 ##############" cd /mnt/jfinalgit/web/jfinalweb mvn package echo "############## maven打包完毕,关闭tomcat复制war包 ##############" killall java sleep 3s cd /mnt/apache-tomcat-9.0.0.M4/webapps/jf cp /mnt/jfinalgit/web/jfinalweb/target/jfinalweb-V0.1.war . jar -xvf jfinalweb-V0.1.war cd /mnt/ echo "############# 进入mnt目录开始启动tomcat,并查看日志###########" ./tomcatstart tailf catalina.out &
buildpkg=/mnt/tbkmark-tomcat-9.0.0.M4/gitsourcepkg/ buildpkgName=tbkmark-0.0.1-SNAPSHOT.war targetpath=/mnt/tbkmark-tomcat-9.0.0.M4/gitsourcepkg/tbk_market/target/tbkmark-0.0.1-SNAPSHOT.war projectName=/mnt/tbkmark-tomcat-9.0.0.M4/gitsourcepkg/tbk_market tomcatName=tbkmark projectPath=/mnt/tbkmark-tomcat-9.0.0.M4/webapps/ROOT startpath=/mnt/tbkmark-tomcat-9.0.0.M4/bin/startup.sh logpath=/mnt/tbkmark-tomcat-9.0.0.M4/logs/catalina.out echo "##### start build tbkmark #####" cd $buildpkg rm -rf * git clone https://git.oschina.net/mrning001/tbk_market.git echo "##### git pull ok #####" cd $projectName mvn package -Dmaven.test.skip=true echo "##### maven pkg ok #####" ps -ef | grep tomcat | grep $tomcatName | awk ‘{print $2}‘|xargs kill -9 cd $projectPath rm -rf * cp $targetpath $projectPath jar -xvf $buildpkgName echo "##### kill tomcat and cp pkg to root ok !!! #####" \cp /application.properties /mnt/tbkmark-tomcat-9.0.0.M4/webapps/ROOT/WEB-INF/classes sh $startpath sleep 5s tailf -n 500 $logpath
ps -ef|grep xxxxName|grep tomcat|awk ‘{print $2}‘|xargs kill -9 sh /mnt/data1/esports/tomcat-8.0.35/bin/startup.sh
原文:https://www.cnblogs.com/ning-blogs/p/12070366.html