Search code examples
shellunixjobsgnu-screenhpc

screen command in Unix


I have logged onto the HPC, and then used : screen -list
It showed the following.

 > There are screens on:
    >   40032.pts-45.willow (16/06/17 13:59:42) (Detached)
    >   37414.pts-45.willow (15/06/17 15:01:30) (Detached)
    >   37002.pts-45.willow (15/06/17 14:51:18) (Attached)

I don't understand why 37002 showed attached. However, if I try to use: screen -r 37002

There is a screen on:
    37002.pts-45.willow (15/06/17 14:51:18) (Attached)
There is no screen to be resumed matching 37002.

From my understanding, there is no screen for 37002.


Solution

  • Switch to tmux ;) Seriously. I think that tmux is way better for keeping stuff alive.

    https://github.com/tmux/tmux/wiki

    In your case, it looks like you have started screen inside screen. In that case you can get this kind of result:

    ┌[michalo@pi]
    └[~] screen -list
    There are screens on:
        770.ttys000.pi  (Detached)
        831.ttys004.pi  (Attached)
    2 Sockets in /var/folders/hd/fsr88b711nq969xyv329d68c0000gn/T/.screen.
    
    ┌[michalo@pi]
    └[~] screen -r 831
    There is a screen on:
        831.ttys004.pi  (Attached)
    There is no screen to be resumed matching 831.
    

    To reproduce this one, simply do

    screen
    screen
    

    And then, from another terminal, try to log into attached session. It should give you error as you stated. To be honest, I don't know whether this is a bug or a feature ;)