一、现象

jenkins中使用了ssh插件,远程登录服务器并执行脚本

脚本如下:

#!/bin/bash
pid=`ps -ef | grep python | awk '{print $2}'`
kill $pid
git fetch --all
git reset --hard origin/master
git pull
nohup python3 run.py &

发现当触发jenkins之后,虽然脚本已经执行完成并且构建成功,但是jenkins构建状态一直显示为构建中

二、解决方法

修改脚本最后一行如下:

nohup python3 run.py > /dev/null 2>&1 &

重新构建,该问题解决

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐