自动部署jenkins war包脚本

Posted renliping

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动部署jenkins war包脚本相关的知识,希望对你有一定的参考价值。

++ date +%Y%m%d-%H%M
+ BAK_DIR=$\'/home/zcq/backup/20171113-1715\\r\'
\' \']\' -n \'ps aux |grep tomcat-wap|grep -v grep|awk \'\\\'\'{print }\'\\\'\'
\' kill -9 ps aux \'|grep\' \'tomcat-wap|grep\' -v \'grep|awk\' \'\'\\\'\'{print\' \'}\'\\\'\'
tomcat-wap.sh: line 11: kill: ps: arguments must be process or job IDs
tomcat-wap.sh: line 11: kill: aux: arguments must be process or job IDs
tomcat-wap.sh: line 11: kill: |grep: arguments must be process or job IDs
tomcat-wap.sh: line 11: kill: tomcat-wap|grep: arguments must be process or job IDs
tomcat-wap.sh: line 11: kill: -v: arguments must be process or job IDs
tomcat-wap.sh: line 11: kill: grep|awk: arguments must be process or job IDs
tomcat-wap.sh: line 11: kill: \'{print: arguments must be process or job IDs
: arguments must be process or job IDs

报错:解决 kill -9 `$TOMCAT_PID`# 加反引号即可

 

报这个错:

TOMCAT_PID=`ps aux |grep tomcat-wap|grep -v grep|awk \'{print $2}\'`用反引号引起来截取的进程号

反单引号``,把命令的结果赋给变量

实时更新Apache下的war包,yes |  cp /root/.jenkins/workspace/wap/target/fuqin-wap.war /var/www/html/download/

 

以上是关于自动部署jenkins war包脚本的主要内容,如果未能解决你的问题,请参考以下文章

Jenkins自动打war包,并部署到tomcat服务器

性能测试四十八:Jenkins+Ant+Jmeter系统部署

《自动化系列》Jenkins部署springboot项目jar包

jenkins 自由风格构建war包,并自动部署(jenkins和tomcat同一台机器)

如何使用jenkins部署jar包

jenkins搭建自动化部署平台(svn+tomcat重启)