持续集成工具Jenkins
Linux下有两种使用方式今天介绍一种 哈哈 !!后期补上!!
1:开篇点题,先要有环境。
配置 java 环境
export JAVA_HOME=/usr/local/tools/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
配置 maven 环境
export MAVEN_HOME=/usr/local/tools/maven-3.5.3
export MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin
2:a.下载 Jenkins.war 扔到 tomcat 的下。即 :webapps 下
b.启动tomcat(这里是默认端口8080) 访问你的tomcat --> http:192.168.xxx.xxx:8080/jenkins
c.默认管理员密码在 /root/.jenkins/secrets/initialAdminPassword 下
cat /root/.jenkins/secrets/initialAdminPassword 或者 vim /root/.jenkins/secrets/initialAdminPassword
复制密码登录即可
#! /bin/bash ttomcat_status=`ps -ef | grep tomcat-lianyun | grep -v grep| awk '{print $2}'` if [[ $ttomcat_status -gt 0 ]];then kill -9 $ttomcat_status fi rm -rf /opt/haolei/web/tomcat-lianyun/webapps/lianyun.war mv /var/lib/jenkins/workspace/haolei_dev/sound-haolei-machine-lianyun/target/sound-haolei-machine-lianyun.war /opt/haolei/web/tomcat-lianyun/webapps/lianyun.war cp /opt/haolei/web/tomcat-lianyun/webapps/lianyun.war /opt/haolei/bak/lianyun.war.$version.`date "+%Y%m%d%H%M%S"`.bak sleep 3 bash /opt/haolei/web/tomcat-lianyun/bin/startup.sh
export JAVA_HOME=/usr/local/jdk /haolei/tomcat-lianyun/bin/shutdown.sh rm -rf /haolei/tomcat-lianyun/webapps/lianyun mv /haolei/tomcat-lianyun/webapps/sound-haolei-machine-lianyun.war /haolei/tomcat-lianyun/webapps/lianyun.war cp /haolei/tomcat-lianyun/webapps/lianyun.war /haolei/bak/lianyun.war.$version.`date "+%Y%m%d%H%M%S"`.bak sleep 3 ps -ef | grep tomcat-lianyun | grep -v grep| awk '{print $2}'|xargs kill -9 /haolei/tomcat-lianyun/bin/startup.sh
/opt/haolei/server/sound-haolei-core-server-0.0.1-SNAPSHOT/bin/stop.sh rm -rf /opt/haolei/server/* cp /var/lib/jenkins/workspace/haolei_dev/sound-haolei-core-server/target/sound-haolei-core-server-0.0.1-SNAPSHOT-assembly.tar.gz /opt/haolei/server -a cd /opt/haolei/server whoami sleep 10 tar zxvf sound-haolei-core-server-0.0.1-SNAPSHOT-assembly.tar.gz whoami /opt/haolei/server/sound-haolei-core-server-0.0.1-SNAPSHOT/bin/start.sh whoami
export JAVA_HOME=/usr/java/jdk1.8.0 portal_status=`ps -ef | grep portal.jar | grep -v grep| awk '{print $2}'` if [[ $portal_status -gt 0 ]];then kill -9 $portal_status fi rm -rf /home/ifrs9_bak/portal.war
pro_path=/home/ifrs9_bak mv /root/.jenkins/workspace/zframe-portal/target/portal.war $pro_path/portal.war cp $pro_path/portal.war $pro_path/portal.war.$version.`date "+%Y%m%d%H%M%S"`.bak cd $pro_path nohup java -server -Xms512m -Xmx1024m -jar portal.war --spring.profiles.active=test >portal.log & tail -f portal.log
上一篇: MD5加密工具类
下一篇: 服务器开启远程连接失败怎么解决
推荐阅读
-
通过 Azure Pipelines 实现持续集成之docker容器化
-
centos下GitLab+Jenkins持续集成环境搭建(安装jenkins)
-
高德引擎构建及持续集成技术演进之路
-
[PHP] 持续交付Jenkins安装
-
Jenkins+Docker持续集成的实现
-
基于Docker+K8S+GitLab/SVN+Jenkins+Harbor搭建持续集成交付环境的详细教程
-
ASP.NET Core+Docker+Jenkins实现持续集成的完整实例
-
Jenkins持续集成01—Jenkins服务搭建和部署
-
jenkins + ansible + docker 代码集成发布
-
iOS使用fastlane实现持续集成的方法教程