码迷,mamicode.com
首页 > 其他好文 > 详细

jenkins

时间:2017-04-17 13:25:58      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:密码   spi   ddd   添加   jenkins   build   构建   sans   apache   

jenkins

常用备注- - -

jenkins自动部署

  • 插件
    Subversion Plug-in
    enkins SSH plugin

  • 设置

1.安装好插件后,在系统配置中,添加ssh用户密码。
2.job中,找到> 构建环境>Execute shell script on remote host using ssh> 在 Post build script中输入shell命令

  1. echo "client部署中..."

  2. source /etc/profile

  3. sh "/home/ubuntu173/tomcatClient/bin/shutdown.sh"

  4. mv "/home/ubuntu173/.jenkins/workspace/client/target/clientModule.war" "/home/ubuntu173/tomcatClient/webapps/"

  5. sh "/home/ubuntu173/tomcatClient/bin/startup.sh"

  6. echo "client部署结束..."

  • 部署jar
    在linux中写好shell脚本。直接执行即可,如果采用nohup方式,要在shell中重定向输出。
    shell脚本

  1. #!/bin/bash

  2. export JAVA_HOME=/opt/software/jdk1.8.0_25

  3. export MAVEN_HOME=/opt/software/apache-maven-3.3.9

  4. export CLASSPATH=.:${JAVA_HOME}/lib

  5. export PATH=${JAVA_HOME}/bin:${MAVEN_HOME}/bin:$PATH

  6. echo "部署中"

  7. kill -9 lsof -t -i:18080

  8. kill -9 lsof -t -i:18180

  9. kill -9 lsof -t -i:18081

  10. kill -9 lsof -t -i:18082

  11. kill -9 lsof -t -i:18083

  12. kill -9 lsof -t -i:18084

  13. 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 &

  14. 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 &

  15. 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 &

  16. 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 &

  17. 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 &

  18. 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 &

  19. echo "部署完成"

  20. exit;

在job的配置中,直接执行sh就可以

  1. sh /opt/software/deploy.sh

Poll SCM中配置5分钟构建一次

  1. H/5 * * * *

jenkins

标签:密码   spi   ddd   添加   jenkins   build   构建   sans   apache   

原文地址:http://www.cnblogs.com/-10086/p/6722062.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!