jenkins 部署脚本



port=20000
#war包名称
name=$1
#war包要部署的地方
path=$2
#jenkins放war包的地方
path_w=$3
#pid名称
pid_name="${4}.pid"
pid="$(cat /var/run/"${pid_name}")"
#$(ps -ef | grep java | grep $name | awk '{print $2}')

echo "s1 = $name"
echo "s2 = $path"
echo "s3 = $path_w"

echo "pid = $pid"

#rm the war if exist
echo "$path/$name"
if [ -f "$path/$name" ];then
echo "delete the file $name"
rm -f  $path/$name
else
echo "the file $name is not exist"
fi

sleep 1s

#copy the war 
cp $path_w/$name $path/
echo "copy the file $name from $path_w to $path"

#shundow the process if exist
if [ $pid ];then

kill -9 $pid
echo "kill the process $name pid = $pid"
else
echo "process is not exist"
fi

sleep 1s
#start the application

#要切换到项目目录下才能在这里生成日志
cd $path

#防止被jenkins杀掉进程
BUILD_ID=dontKillMe

nohup java -server -Xms256m -Xmx512m -jar -Dserver.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值