首页 > 解决方案 > Chef : 在节点上将 jenkins 代理作为后台进程运行

问题描述

我在控制台上手动运行这个命令,java -jar agent.jar -jnlpUrl {{master_url}}/computer/{{slave_name}}/slave-agent.jnlp -secret {{secret_key}} > /dev/null 2>&1 &

基本上它是在后台启动詹金斯奴隶并且它工作正常,现在当我尝试在厨师中做同样的事情时,厨师客户端进程挂起并超时,因为进程永远不会进入后台并且会话保持活动状态。

command = Mixlib::ShellOut.new("java -jar agent.jar -jnlpUrl {{master_url}}/computer/{{slave_name}}/slave-agent.jnlp -secret {{secret_key}}" > /dev/null 2>&1 &")

command.run_command

标签: rubyunixjenkinsprocesschef-infra

解决方案


你真的应该为此使用适当的服务层,它在所有现代 Linux 发行版中都是 systemd。


推荐阅读