1. 程式人生 > >jenkins構建並遠端釋出後執行shell指令碼

jenkins構建並遠端釋出後執行shell指令碼

由於jenkins遠端釋出war檔案到不同環境下的tomcat下時,會先刪除同名檔案後再進行遠端拷貝,此時保留在本地的配置檔案需收到copy。
為實現自動化釋出,特在釋出後執行shell指令碼,遠端copy,同時重啟tomcat

解決步驟:
1:遠端執行xc.sh指令碼
2:指令碼配置

#!/bin/sh
#datetime: 2015-3-3 17:00
#author:XiaoChong
#desc:此指令碼用來在jenkins構建完成後,遠端copy配置檔案到專案中,並重啟tomcat


#copy API工程的配置檔案
cp -r /data/apache-tomcat-7.0
.56/build/API/* /data/apache-tomcat-7.0.56/webapps/API/WEB-INF/classes #重啟tomcat bash /data/apache-tomcat-7.0.56/bin/shutdown.sh sleep 30s bash /data/apache-tomcat-7.0.56/bin/startup.sh