自动部署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/