Execute shell Command

BUILD_ID=DONTKILLME
if [ ! -d "/usr/jenkins/$JOB_NAME" ]; then
mkdir /usr/jenkins/$JOB_NAME
fi
cd /usr/jenkins/$JOB_NAME
rm -rf *
cp $JENKINS_HOME/workspace/$JOB_NAME/target/*.zip ./
unzip -o *.zip
cd /usr/zocrm/server/tomcat8/zocrm/bin

PROJECT=/usr/zocrm/server/tomcat8/zocrm/
echo "--------------shutdown tomcat server-------------"

count=`ps -ef|grep -v 'grep'|grep $PROJECT |awk '{print $2}'|wc -l`
if [ $count -gt 0 ];then
echo "kill running process, please waiting..."
kill -9 `ps -ef|grep -v 'grep'|grep $PROJECT|awk '{print $2}'`
sleep 1
else
echo "--------------shutdown tomcat done -------------"
fi

rm -rf /usr/zocrm/projects/zocrm/WEB-INF/classes/cn/aresoft
rm -rf /usr/zocrm/projects/zocrm/WEB-INF/lib
unzip -o /usr/jenkins/$JOB_NAME/*.war -d /usr/zocrm/projects/zocrm
export JAVA_PATH=/usr/bin
export JRE_HOME=/usr
./startup.sh

*********************************日志************************************************

Started by user dev
Building in workspace /root/.jenkins/workspace/zocrm-147
Updating https://172.10.10.101/svn/路径 at revision '2019-05-27T15:49:42.625 +0800'
Using sole credentials liaokai/****** in realm ‘<https://172.10.10.100:443> VisualSVN Server’
U
At revision 9695

Using sole credentials liaokai/****** in realm ‘<https://172.10.10.100:443> VisualSVN Server’
Parsing POMs
using global settings config with name MyGlobalSettings
Replacing all maven server entries not found in credentials list is true
Established TCP socket on 33518
[zocrm-147] $ /usr/jenkins/jdk1.8.0_152/bin/java -cp /root/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.12-alpha-1.jar:/root/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven3/boot/plexus-classworlds-2.5.2.jar:/root/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven3/conf/logging jenkins.maven3.agent.Maven35Main /root/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven3 /root/.jenkins/war/WEB-INF/lib/remoting-3.10.2.jar /root/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.12-alpha-1.jar /root/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.12-alpha-1.jar 33518
<===[JENKINS REMOTING CAPACITY]===>channel started
using global settings config with name MyGlobalSettings
Replacing all maven server entries not found in credentials list is true
Executing Maven: -B -f /root/.jenkins/workspace/zocrm-147/pom.xml -gs /tmp/global-settings127350087469421300.xml clean package -Pdev
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building zocrm.manager 2.1.6
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ zocrm.manager ---
[INFO] Deleting /root/.jenkins/workspace/zocrm-147/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ zocrm.manager ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 860 resources
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ zocrm.manager ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1488 source files to /root/.jenkins/workspace/zocrm-147/target/classes
[INFO] /root/.jenkins/workspace/zocrm-147/src/cn/aresoft/manager/push/UmengNotification.java: Some input files use or override a deprecated API.
[INFO] /root/.jenkins/workspace/zocrm-147/src/cn/aresoft/manager/push/UmengNotification.java: Recompile with -Xlint:deprecation for details.
[INFO] /root/.jenkins/workspace/zocrm-147/src/cn/aresoft/manager/service/impl/redis/RedisCacheStorageServiceImpl.java: Some input files use unchecked or unsafe operations.
[INFO] /root/.jenkins/workspace/zocrm-147/src/cn/aresoft/manager/service/impl/redis/RedisCacheStorageServiceImpl.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- aspectj-maven-plugin:1.7:compile (default) @ zocrm.manager ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ zocrm.manager ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/.jenkins/workspace/zocrm-147/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ zocrm.manager ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ zocrm.manager ---
[INFO] No tests to run.
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ zocrm.manager ---
[INFO] Packaging webapp
[INFO] Assembling webapp [zocrm.manager] in [/root/.jenkins/workspace/zocrm-147/target/zocrm.manager-2.1.6]
[INFO] Processing war project
[INFO] Copying webapp resources [/root/.jenkins/workspace/zocrm-147/webapp]
[INFO] Webapp assembled in [1695 msecs]
[INFO] Building war: /root/.jenkins/workspace/zocrm-147/target/zocrm.manager-2.1.6.war
[INFO]
[INFO] --- maven-assembly-plugin:2.4:single (makezip) @ zocrm.manager ---
[INFO] Reading assembly descriptor: assembly.xml
[INFO] Building zip: /root/.jenkins/workspace/zocrm-147/target/zocrm2.1.6.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.512 s
[INFO] Finished at: 2019-05-27T15:50:38+08:00
[INFO] Final Memory: 37M/433M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /root/.jenkins/workspace/zocrm-147/pom.xml to zocrm.manager/zocrm.manager/2.1.6/zocrm.manager-2.1.6.pom
[JENKINS] Archiving /root/.jenkins/workspace/zocrm-147/target/zocrm.manager-2.1.6.war to zocrm.manager/zocrm.manager/2.1.6/zocrm.manager-2.1.6.war
[JENKINS] Archiving /root/.jenkins/workspace/zocrm-147/target/zocrm2.1.6.zip to zocrm.manager/zocrm.manager/2.1.6/zocrm.manager-2.1.6.zip
channel stopped
[zocrm-147] $ /bin/sh -xe /tmp/jenkins1993294478867023234.sh
+ BUILD_ID=DONTKILLME
+ '[' '!' -d /usr/jenkins/zocrm-147 ']'
+ cd /usr/jenkins/zocrm-147
+ rm -rf zocrm2.1.6.zip zocrm.manager-2.1.6.war
+ cp /root/.jenkins/workspace/zocrm-147/target/zocrm2.1.6.zip ./
+ unzip -o zocrm2.1.6.zip
Archive: zocrm2.1.6.zip
extracting: zocrm.manager-2.1.6.war
+ cd /usr/zocrm/server/tomcat8/zocrm/bin
+ PROJECT=/usr/zocrm/server/tomcat8/zocrm/
+ echo '--------------shutdown tomcat server-------------'
--------------shutdown tomcat server-------------
++ ps -ef
++ grep -v grep
++ grep /usr/zocrm/server/tomcat8/zocrm/
++ awk '{print $2}'
++ wc -l
+ count=3
+ '[' 3 -gt 0 ']'
+ echo 'kill running process, please waiting...'
kill running process, please waiting...
++ ps -ef
++ grep -v grep
++ grep /usr/zocrm/server/tomcat8/zocrm/
++ awk '{print $2}'
+ kill -9 4388 4389 4390
+ sleep 1
+ rm -rf /usr/zocrm/projects/zocrm/WEB-INF/classes/cn/aresoft
+ rm -rf /usr/zocrm/projects/zocrm/WEB-INF/lib
+ unzip -o /usr/jenkins/zocrm-147/zocrm.manager-2.1.6.war -d /usr/zocrm/projects/zocrm
Archive: /usr/jenkins/zocrm-147/zocrm.manager-2.1.6.war
inflating: ...........正文。。。。。。
+ export JAVA_PATH=/usr/bin
+ JAVA_PATH=/usr/bin
+ export JRE_HOME=/usr
+ JRE_HOME=/usr
+ ./startup.sh
Tomcat started.
Process leaked file descriptors. See https://jenkins.io/redirect/troubleshooting/process-leaked-file-descriptors for more information
Finished: SUCCESS

jenkins 自动化部署的更多相关文章

  1. Linux下的Jenkins+Tomcat+Maven+Gitlab+Shell环境的搭建使用(jenkins自动化部署)

    jenkins自动化部署 目标:jenkins上点构建(也可以自动检查代码变化自动构建)>>>项目部署完成. 一.安装jenkins 1.下载jenkins 这里我选择的是war包安 ...

  2. Linux下的Jenkins+Tomcat+Maven+Git+Shell环境的搭建使用(jenkins自动化部署)【转】

    jenkins自动化部署 目标:jenkins上点构建(也可以自动检查代码变化自动构建)>>>项目部署完成. 一.安装jenkins 1.下载jenkins 这里我选择的是war包安 ...

  3. Jenkins自动化部署代码

    通过jenkins自动化部署项目代码可以大幅度节省打包上传部署的时间,提高开发测试的工作效率 ========== 完美的分割线 =========== 1.Jenkins是什么 1)Jenkins是 ...

  4. Linux下的Jenkins+Tomcat+Maven+Git+Shell环境的搭建使用(jenkins自动化部署)

    jenkins自动化部署 目标:jenkins上点构建(也可以自动检查代码变化自动构建)>>>项目部署完成. 一.安装jenkins 1.下载jenkins 这里我选择的是war包安 ...

  5. AspNetCore容器化(Docker)部署(四) —— Jenkins自动化部署

    一.前言 (Jenkins.Docker.Git/Svn组建一套简单的自动化发布流程) 文章中用到的相关服务器角色 角色 环境 功能 开发机 Win10.Docker(Linux OS) 编码.调试 ...

  6. jenkins自动化部署项目1--下载安装启动(windows)

    年初以来断断续续研究jenkins自动化部署项目,前些天终于搞定了,接下来一点点把做的时候遇到的坑以及自己的心得写下来,方便以后复用. 我的jenkins服务是是部署在windows上的 一.下载安装 ...

  7. Jenkins自动化部署入门详细教程

    大纲 1.背景 在实际开发中,我们经常要一边开发一边测试,当然这里说的测试并不是程序员对自己代码的单元测试,而是同组程序员将代码提交后,由测试人员测试: 或者前后端分离后,经常会修改接口,然后重新部署 ...

  8. Windows环境下实现Jenkins自动化部署

    详见:https://blog.csdn.net/Try_harder_every_day/article/details/79170065 Jenkins自动化部署: 几条具体的思路:1.开发人员将 ...

  9. Jenkins 自动化部署上线

    转载于互联网 jenkins自动化部署项目,通过jenkins 部署来节省运维时间,不需要手动cp上线及版本发布 Jenkins 自动化部署上线 Jenkins Jenkins 自动化部署上线一.Je ...

  10. docker安装jenkins自动化部署

    Docker之Jenkins自动化部署 1.拉取jenkins镜像images(类比:java中的类) docker pull jenkinsci/jenkins:lts 或 docker pull ...

随机推荐

  1. TagCloud with xml

    Django后台开发 加了个3D标签云的插件 3DTagCloudwithXML 中使用的是xml生成方式 为了xml自己主动化生成 而不须要去手工改动xml 特地写了个xmlgenerator 比較 ...

  2. angularjs时间轴

    1.炫酷的图片是开端啊 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...

  3. 检測wifi是否须要portal验证 公共场所wifi验证

    何为wifi portal验证? 平时在商场,咖啡厅,银行等公共场所.我们手机提示:有可用WLAN.这些WIFI能够直接连接,不须要password,但须要我们手动在手机网页上进行验证,通常是输入一个 ...

  4. ViewPage+Frament+listView滑动效果

    近期在做一个须要使用Frament+ViewPage制作一个滑动的效果,看了非常多资料,最终实现了,这与大家分享一下战果 总结一下.这里我做了一个Demo分享给大家 我的文件文件夹结构图 1.首先要有 ...

  5. luogu1969 积木大赛

    题目大意 搭建一座宽度为n的大厦,大厦可以看成由n块宽度为1的积木组成,第i块积木的最终高度需要是hi. 在搭建开始之前,没有任何积木(可以看成n块高度为 0 的积木).接下来每次操作,可以选择一段连 ...

  6. 【联系】二项分布的对数似然函数与交叉熵(cross entropy)损失函数

    1. 二项分布 二项分布也叫 0-1 分布,如随机变量 x 服从二项分布,关于参数 μ(0≤μ≤1),其值取 1 和取 0 的概率如下: {p(x=1|μ)=μp(x=0|μ)=1−μ 则在 x 上的 ...

  7. Linux Shell Scripting Cookbook 读书笔记 4

    正则, grep 1. 正则表达式  正则表达式  描述  示例 ^ 行起始标记  ^hell匹配以hell开头的行 $ 行尾标记  test$匹配以test结尾的行 . 匹配任意一个字符  hell ...

  8. CSS Flexbox 弹性盒子模型

    CSS Flexbox 弹性盒子模型 设置元素样式为 display: flex 或 display: inline-flex, 让元素变成flex容器, 从而可以通过flex模式布局它的子元素. f ...

  9. css relative设置top为百分比值

    前言: 最近在学习HTML.CSS的过程中,想模仿一下百度首页.发现搜索框这一部分与上下其它元素的空白距离可以随着窗口大小变化(效果如下图所示),于是自己研究了一下并记录下来. 效果实现 <!D ...

  10. &nbsp; 等等空格用法

    平时经常用到 空格转移字符,记住一个   表示一个字符就可以了. Non-Breaking SPace 记住它是什么的缩写,更有助于我们记忆和使用.下面的字符转义自己视图翻译一下. 记录一下,空格的转 ...