#!/bin/sh export deploy_path=/opt/builds/${JOB_NAME} echo "--------moveFile start--------------" rm -rf $deploy_path mkdir -p $deploy_path cd $deploy_path rm -rf *.jar echo "workspace is ${WORKSPACE}" mv ${WORKSPACE}/bonus-modules/bonus-material/target/bonus-material.jar $deploy_path chmod 777 *.jar echo "--------moveFile end--------------" export bonus_material_enable=true export bonus_material_jar=bonus-material.jar export bonus_material_port=18588 if($bonus_material_enable);then echo "--------bonus_material 开始启动--------------" echo "--------删除bonus__material开始--------------" P_ID=`ps -ef | grep -w $bonus_material_jar | grep -v "grep" | awk '{print $2}'` if [ "$P_ID" == "" ]; then echo "===bonus_material process not exists or stop success" else kill -9 $P_ID echo "bonus_material killed success" fi echo "--------bonus_material开始部署--------------" nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $bonus_material_jar >/dev/null 2>&1 & bonus_material_pid=`lsof -i:$bonus_material_port|grep "LISTEN"|awk '{print $2}'` until [ -n "$bonus_material_pid" ] do bonus_material_pid=`lsof -i:$bonus_material_port|grep "LISTEN"|awk '{print $2}'` done echo "bonus_material pid is $bonus_material_pid" echo "--------bonus_material 启动成功--------------" fi