我在服务器上有一个屏幕会话。我失去了无线连接。重新连接到服务器时,屏幕会话在“screen -ls”中显示为“已附加”。但是我无法通过“screen -d session#”将其分离,也无法通过“screen -X -S session# quit”将其终止。我该如何处理?
感谢致敬!
答案1
暴力破解的方法是:
ps waux | grep screen
找到 pid,然后kill -9
对其执行...否则,尝试这些命令行参数来屏幕:
-D [pid.sessionname] 不启动 screen,而是分离在其他地方运行的 screen 会话(参见 8.1 分离)。'-d' 与从会话的控制终端键入 Ca d 效果相同。'-D' 相当于电源分离键。如果无法分离任何会话,则忽略此选项。与 -r/-R 选项结合使用可以实现更强大的效果:
-d -r
Reattach a session and if necessary detach it first.
-d -R
Reattach a session and if necessary detach or even create it first.
-d -RR
Reattach a session and if necessary detach or create it. Use the first session if more than one session is available.
-D -r
Reattach a session. If necessary detach and logout remotely first.
-D -R
Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author's favorite.
-D -RR
Attach here and now. Whatever that means, just do it.
Note: It is a good idea to check the status of your sessions with screen -list before using this option.