我之前曾使用screen -dr control. 但是,有时此命令不会重新附加到屏幕,而是永远挂起(10 分钟后我中止)。这仅在 SSH 连接意外断开时发生,而不是在屏幕与Ctrl-A d. 其他开关,如screen -x或screen -D -RR也不起作用。
这篇文章建议杀死持有 screen 会话的 PTY,这将导致 screen 完成其断开连接。但是,它只是杀死从中screen -dr control调用的外壳。
例如:
$ ps -ef | grep control | grep -v grep
nomad 7387 7109 0 13:05 pts/50 00:00:00 screen -dr control
nomad 15299 1 0 Nov27 ? 00:13:47 SCREEN -S control
$ ps -ef | grep bash | grep 'pts/50'
nomad 7109 7108 0 12:49 pts/50 00:00:00 -bash
Run Code Online (Sandbox Code Playgroud)
链接的帖子建议杀死 …