Answers:
在大多数情况下,这是可行的:
先决条件:已经reptyr和tmux/ screen安装;您可以使用apt-get或找到它们yum,具体取决于您的平台。
使用Ctrl+ Z暂停该过程。
使用以下命令在后台恢复该过程 bg
查找后台进程的进程ID jobs -l
您会看到类似以下内容:
[1]+ 11475 Stopped (signal) yourprocessname
使用以下命令从当前父项(shell)中取消工作 disown yourprocessname
开始tmux(首选)或screen。
使用reptyr 将进程重新附加到tmux/ screen会话:
reptyr 11475
现在,您可以分离多路复用器(默认Ctrl+ B,D用于tmux,或Ctrl+ A,D用于screen),并在tmux/ 中继续进行过程时断开SSH的连接screen。
之后,当您再次使用SSH连接时,可以连接到多路复用器(例如tmux attach)。
sudo reptyr 1430我仍然得到:“ ... [-]无法在孩子中打开tty。无法附加到pid 1430:权限被拒绝”
                    echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
                    bg,该进程应在后台运行,因此jobs应说Running而不是Stopped。
                    reptyr 很好,但出现权限错误
$ reptyr 30622
[-] Unable to open the tty in the child.
Unable to attach to pid 30622: Permission denied
然后发现
-L    Like '-l', but also redirect the child's stdio to the slave.
像魅力一样运作
$ reptyr -L 30622
Opened a new pty: /dev/pts/4
-L我收到了一条如您所说的消息,Opened a new pty: /dev/pts/6但我的暂停状态top未显示在tmux中。我在这里想念什么?
                    如果该命令可用,则可以使用disown将作业与其终端分离。
从头开始运行nohup更加安全。
nohup?disowning流程如何运作?