【发布时间】:2019-09-17 16:56:15
【问题描述】:
如何使用 Jenkins 触发脚本 A(在 python 中),这样即使在 Jenkins 构建完成后,从脚本 A 内部触发的 shell 脚本也会在后台继续运行。
现在,我观察到,一旦 Jenkins 工作结束,它也会杀死后台 shell 脚本。 但是,在终端上手动运行 python 脚本很好。
有没有办法让我跳过 Jenkins 的后台 shell 脚本?
【问题讨论】:
-
这个
nohup python my_scipt.py &怎么样 -
还有其他方法吗?我无法访问日志并且无法检查它是否在任何步骤都失败
-
您可以将日志捕获到文件 nohup python_script.py > myprogram.out 2> myprogram.err
-
或者更合适的方式
nohup python_script.py > ${BUILD_URL}/consoleText 2> ${BUILD_URL}/consoleText -
但问题是 jenkins build 总会通过
标签: python shell jenkins background-process