我正在使用一个复杂的 bash 脚本,该脚本执行各种操作并重新启动运行它的 Linux (CentOS 6) 服务器。该脚本是从几个不同的地方调用的。 我正在寻找一种方法来在新的进程树中启动这个复杂的 bash 脚本的执行。
我整理了以下文本图来说明该场景:
a_process_that_calls_script
\_ subshells/processes/commands_of_calling_process
...
bash_script
\_ subshells/commands/other_scripts_called
最佳答案
可能重复:How can I launch a new process that is NOT a child of the original process?
如果您有一个进程作为孙进程调用脚本,然后子进程退出,则孙进程将成为 init 进程的子进程。
关于linux - 在新进程树中运行 Bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45579896/