标签:密码 spi ddd 添加 jenkins build 构建 sans apache
常用备注- - -
插件
Subversion Plug-in
enkins SSH plugin
设置
1.安装好插件后,在系统配置中,添加ssh用户密码。
2.job中,找到>构建环境
>Execute shell script on remote host using ssh
> 在Post build script
中输入shell命令
echo "client部署中..."
source /etc/profile
sh "/home/ubuntu173/tomcatClient/bin/shutdown.sh"
mv "/home/ubuntu173/.jenkins/workspace/client/target/clientModule.war" "/home/ubuntu173/tomcatClient/webapps/"
sh "/home/ubuntu173/tomcatClient/bin/startup.sh"
echo "client部署结束..."
部署jar
在linux中写好shell脚本。直接执行即可,如果采用nohup方式,要在shell中重定向输出。
shell脚本
#!/bin/bash
export JAVA_HOME=/opt/software/jdk1.8.0_25
export MAVEN_HOME=/opt/software/apache-maven-3.3.9
export CLASSPATH=.:${JAVA_HOME}/lib
export PATH=${JAVA_HOME}/bin:${MAVEN_HOME}/bin:$PATH
echo "部署中"
kill -9 lsof -t -i:18080
kill -9 lsof -t -i:18180
kill -9 lsof -t -i:18081
kill -9 lsof -t -i:18082
kill -9 lsof -t -i:18083
kill -9 lsof -t -i:18084
nohup java -jar /home/find2i/.jenkins/jobs/fidn2i/workspace/find2i-client-optometry/target/find2i-client-optometry-1.0-SNAPSHOT.jar >/opt/git/find2i-aggregator/opt.log &
nohup java -jar /home/find2i/.jenkins/jobs/fidn2i/workspace/find2i-service-user/target/find2i-service-user-1.0-SNAPSHOT.jar >/opt/git/find2i-aggregator/user.log &
nohup java -jar /home/find2i/.jenkins/jobs/fidn2i/workspace/find2i-service-doctor/target/find2i-service-doctor-1.0-SNAPSHOT.jar >/opt/git/find2i-aggregator/doctor.log &
nohup java -jar /home/find2i/.jenkins/jobs/fidn2i/workspace/find2i-service-hospital/target/find2i-service-hospital-1.0-SNAPSHOT.jar >/opt/git/find2i-aggregator/hospital.log &
nohup java -jar /home/find2i/.jenkins/jobs/fidn2i/workspace/find2i-service-emr/target/find2i-service-emr-1.0-SNAPSHOT.jar >/opt/git/find2i-aggregator/emr.log &
nohup java -jar /home/find2i/.jenkins/jobs/fidn2i/workspace/find2i-client-wechat/target/find2i-client-wechat-1.0-SNAPSHOT.jar > /opt/git/find2i-aggregator/wechat.log &
echo "部署完成"
exit;
在job的配置中,直接执行sh就可以
sh /opt/software/deploy.sh
Poll SCM中配置5分钟构建一次
H/5 * * * *
标签:密码 spi ddd 添加 jenkins build 构建 sans apache
原文地址:http://www.cnblogs.com/-10086/p/6722062.html