"손실된" 화면 세션을 복구하는 방법은 무엇입니까?

"손실된" 화면 세션을 복구하는 방법은 무엇입니까?

어떻게든 화면에 "알려지지" 않고 화면 창을 닫았기 때문에 세션이 여전히 표시되어 있습니다 attached. 이로 인해 이 세션에 다시 연결할 수 없습니다. 어떡해?

me@iupr-serv8:~$ screen -r
There are several suitable screens on:
    25028.pts-19.XXX-serv8  (01/05/2012 07:15:34 PM)    (Attached)
    24658.pts-19.XXX-serv8  (01/05/2012 07:11:38 PM)    (Detached)
    24509.pts-19.XXX-serv8  (01/05/2012 07:10:00 PM)    (Detached)
    18676.pts-5.XXX-serv8   (01/02/2012 06:55:33 PM)    (Attached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
me@XXX-serv8:~$ screen -r 25028
There is a screen on:
    25028.pts-19.XXX-serv8  (01/05/2012 07:15:33 PM)    (Attached)
There is no screen to be resumed matching 25028.

[고쳐 쓰다]

마침내 나는 세션이 손실된 것이 아니라 첫 번째 세션의 ID가 이라는 것을 알았습니다 0. 두 번째 세션의 ID는 입니다 1.

답변1

먼저 를 사용하여 분리해 보세요 screen -d. 그래도 작동하지 않으면 오름차순으로 시도해 볼 수 있습니다.강조하다,

   -d|-D [pid.tty.host]
        does  not  start screen, but detaches the elsewhere running screen session. It has the
        same effect as typing "C-a d" from screen's controlling terminal. -D is the equivalent
        to  the  power  detach key.  If no session can be detached, this option is ignored. In
        combination with the -r/-R option more powerful effects can be achieved:

   -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.

답변2

screen -r '1234.somescreensession'

화면에 다음 중 하나가 있습니다.

1234.somescreensession(첨부파일)

일치하는 1234.somescreensession을 복원할 화면이 없습니다.

이는 화면 세션을 되돌리는 쉬운 방법입니다.

screen -D -r '1234.somescreensession'

답변3

Write Failed: broken pipe스크린 세션을 연결할 때 메시지와 함께 SSH 연결이 예기치 않게 종료된 후에도 동일한 문제가 발생했습니다. 그러나 위 명령을 사용하여 화면 세션을 다시 연결할 수 없습니다. 저는 다음 버전을 사용하고 있으니 참고하세요.

~> screen --version
Screen version 4.00.03 (FAU) 23-Oct-06

분명히 아직 실행 중인 인스턴스가 있어서 sshd세션을 분리하고 다시 연결할 수 없습니다. PID적절한 인스턴스를 식별 sshd하고 kill핑한 후 reconnect 를 사용할 수 있었습니다 screen -r.


참고: 하나 이상의 sshd악마를 발견하게 될 것입니다. 하나는 현재 로그인에 해당하고 다른 하나는 오래된 screen세션에 해당합니다(실제로 sshd다른 여러 악마에 속해 실행 중인 다른 악마가 여러 개 있을 수 있습니다 screen).

답변4

때로는 여러 화면이 백그라운드에서 실행되고 있습니다.

다음과 같은 방법으로 복원할 수 있습니다.

screen -r [pid]

화면을 얻으려면 먼저 실행 screen -R한 다음 실행 중인 모든 PID를 화면에 표시한 다음 복구를 수행합니다 screen -r [pid].

관련 정보