解决jenkins 使用ssh插件执行脚本,导致一直处于构建中无法停止
一、现象jenkins中使用了ssh插件,远程登录服务器并执行脚本脚本如下:#!/bin/bashpid=`ps -ef | grep python | awk '{print $2}'`kill $pidgit fetch --allgit reset --hard origin/mastergit pullnohup python3 run.py &发现当触发jenkins之后,虽然脚
·
一、现象
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 &
重新构建,该问题解决
更多推荐
已为社区贡献3条内容
所有评论(0)