使用jenkins實現自動化部署的案例記錄:tomcat+svn+maven+ssh+jenkins
阿新 • • 發佈:2018-11-07
使用jenkins實現自動化部署的案例記錄:tomcat+svn+maven+ssh+jenkins
1.全域性配置,配置專案對應的tomcat伺服器的ssh登入地址,埠,密碼,路徑(寫/即可)
2.2-系統maven配置
3.構建一個maven風格的專案,選擇jdk版本
4.4-專案原始碼管理
5.5-觸發器和構建環境
6.6-preStepsAndBuild
7.7.構建後的傳輸war檔案-刪除原有部署的專案-暫停tomcat和啟動tomcat
#!/bin/sh pid=`ps aux | grep /root/apache-tomcat-7.0.63 | grep -v grep \ | grep -v /root/apache-tomcat-7.0.63/bin/restart.sh | awk '{print $2}'` echo $pid if [ -n "$pid" ] then { echo ===========shutdown================ pid=`ps aux | grep /root/apache-tomcat-7.0.63 | grep -v grep \ | grep -v /root/apache-tomcat-7.0.63/bin/restart.sh | awk '{print $2}'` if [ -n "$pid" ] then { echo ========kill /root/apache-tomcat-7.0.63 begin============== echo $pid kill -9 $pid echo ========kill /root/apache-tomcat-7.0.63 end============== } fi sleep 2 } fi echo ===========startup==============