10:30:15 Started by user unknown or anonymous 10:30:15 Running as SYSTEM 10:30:15 Building in workspace /data/jenkins/workspace/test-v5qy-kms-Update-Restart 10:30:15 [test-v5qy-kms-Update-Restart] $ /bin/sh -xe /data/apache-tomcat-jenkins/temp/jenkins4329201432486076224.sh 10:30:15 + scp /data/jenkins/workspace/test-v5qy-source-back-02/src/badp-bcxin-5.x/obpm-kms-consul/target/obpm-kms-consul-5.x.nightbuild.jar 172.20.0.160:/data/workspace/test-v5qy-source-package/obpm-kms.jar 10:30:24 [SSH] script: 10:30:24 PATH="/usr/local/maven:/usr/local/n/versions/node/16.0.0/bin:/usr/local/jdk1.8/bin:/usr/local/node/bin:/usr/local/jdk1.8/bin:/usr/local/node/bin:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin:/usr/local/maven/bin:/usr/local/git/bin:/root/bin:/usr/local/maven/bin:/usr/local/git/bin:/usr/local/maven/bin:/usr/local/git/bin:/usr/local/maven/bin:/usr/local/git/bin:/usr/local/maven/bin:/usr/local/git/bin:/usr/local/maven/bin:/usr/local/git/bin" 10:30:24 JAVA_HOME="/usr/local/jdk1.8" 10:30:24 JAVA_CLASS="/usr/local/jdk1.8/lib" 10:30:24 HOME="/root" 10:30:24 10:30:24 #JAVA 10:30:24 export JAVA_HOME=/usr/local/java 10:30:24 export JAVA_CLASS=$JAVA_HOME/lib 10:30:24 export PATH=$JAVA_HOME/bin:$PATH 10:30:24 10:30:24 10:30:24 #源码包所在目录 10:30:24 PACKAGE=/data/workspace/test-v5qy-source-package 10:30:24 10:30:24 #工作目录 10:30:24 WORK=/data/workspace/test-v5qy-runing/kms 10:30:24 10:30:24 JAR=obpm-kms.jar 10:30:24 10:30:24 #启动参数 10:30:24 PARAMETER1="-server -Xms512m -Xmx512m -DSW_AGENT_NAME=obpm-kms-instance -DSW_AGENT_COLLECTOR_BACKEND_SERVICES=172.31.0.22:11800 -jar -Dlog4j2.formatMsgNoLookups=true" 10:30:24 PARAMETER2="--myapps.storage.root=/data/storage-merged" 10:30:24 LOGS=kms-error.log 10:30:24 10:30:24 #进程号 10:30:24 PID=$(ps -ef|grep -v grep|grep ${JAR}|awk '{print $2}') 10:30:24 10:30:24 #获取进程的状态0为死亡,1存在 10:30:24 PID_STATUS=$(ps -ef|grep -v grep|grep ${JAR}|wc -l) 10:30:24 10:30:24 10:30:24 #重新启动 10:30:24 if [ $PID_STATUS -eq 1 ] 10:30:24 then 10:30:24 kill $PID 10:30:24 sleep 15 10:30:24 kill -9 $PID 10:30:24 fi 10:30:24 10:30:24 if [ -e ${WORK}/${JAR} ] 10:30:24 then 10:30:24 rm -f ${WORK}/${JAR} 10:30:24 fi 10:30:24 10:30:24 cp ${PACKAGE}/${JAR} ${WORK}/${JAR} 10:30:24 cd ${WORK} 10:30:24 10:30:24 nohup java ${PARAMETER1} -jar ${JAR} ${PARAMETER2} > /dev/null 2> ${LOGS} & 10:30:24 10:30:24 10:30:24 #检查是否启动 10:30:24 10:30:24 if [ $PID_STATUS -eq 1 ] 10:30:24 then 10:30:24 echo "启动成功" 10:30:24 else 10:30:24 echo "启动失败" 10:30:24 fi 10:30:24 10:30:24 #启动命令参考如下 10:30:24 #nohup java -server -Xms512m -Xmx512m -jar -Dlog4j2.formatMsgNoLookups=true obpm-kms.jar --myapps.storage.root=/data/storage-merged > /dev/null 2> /data/workspace/test-v5qy-runing/kms/kms-error.log & 10:30:24 10:30:24 [SSH] executing... 10:30:39 bash: 第 36 行:kill: (8649) - 没有那个进程 10:30:42 启动成功 10:30:42 10:30:42 [SSH] completed 10:30:42 [SSH] exit-status: 0 10:30:42 10:30:42 Finished: SUCCESS