linux - 在新进程树中运行 Bash 脚本

标签 linux bash

我正在使用一个复杂的 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/

相关文章:

linux -/dev/serial/by-id 有多独特

linux - 在 bash 中读取一行文件

linux - 我愚蠢地运行了 "chmod 400 chmod",现在它似乎永远坏掉了

linux - freeTDS bash : Executing sql queries in Microsoft SQL server

c++ - 使用 std::cin 语句使自动超时

python - wxPython 中的 "NotImplementedError: wxGCDC is not available on this platform"

c - 如何解释 C 命令行参数中的特殊字符?

linux - 在 docker 中执行命令显示错误的 $PATH

c++ - 与 dlopen 的动态链接 : symbol not found

c++ - 如何从cuda中的设备函数调用现有的主机函数