使用 Kernel.spawn
我可以从 ruby 中启动一个新进程,执行一些任意的 shell 命令。新进程将出现在与 ruby 进程相同的 control group
中。我怎样才能改变它让它自己进入?
我想要这个的原因是我的 ruby 进程由 systemd
管理,我不希望在 ruby 进程重新启动时清理/终止任何这些特定的 shell 命令进程.
最佳答案
我没有找到任何方法来做到这一点。相反,我将 systemd 脚本的 KillMode
更改为 process
,这解决了问题:Can't detach child process when main process is started from systemd
关于ruby - 来自 ruby : How do I spawn a process in a different control group than the current?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47433911/