Bonus-Cloud-Material/scripts/deploy.sh

37 lines
1.3 KiB
Bash
Raw Normal View History

2024-10-12 17:33:36 +08:00
#!/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