Coder Perfect

What is the best way to keep track of running screen sessions?


I have a number of servers on which I do screen experiments. The following is the procedure:

I can simply discover which servers the experiments are running on by sshing to all servers and listing my ongoing processes (using top or ps).

However, once the trials are complete, how can I determine which servers have a screen session open (so that I can inspect the output, relaunch them, and so on)?

PS: My tests also save their results to files, but that isn’t the purpose of my inquiry.

Asked by Wookai

Solution #1

Run the following command as that user to see a list of all screen sessions:

screen -ls

You can do the following to observe all screen sessions on a specific machine:

ls -laR /var/run/screen/

This is what I get on my computer:

gentle ~ # ls -laR /var/run/screen/

total 1
drwxrwxr-x  4 root utmp   96 Mar  1  2005 .
drwxr-xr-x 10 root root  840 Feb  1 03:10 ..
drwx------  2 josh users  88 Jan 13 11:33 S-josh
drwx------  2 root root   48 Feb 11 10:50 S-root

total 0
drwx------ 2 josh users 88 Jan 13 11:33 .
drwxrwxr-x 4 root utmp  96 Mar  1  2005 ..
prwx------ 1 josh users  0 Feb 11 10:41 12931.pts-0.gentle

total 0
drwx------ 2 root root 48 Feb 11 10:50 .
drwxrwxr-x 4 root utmp 96 Mar  1  2005 ..

To manage security, state, and streams, this is a fantastically Unixy usage of Unix Sockets wrapped in filesystem permissions.

Answered by joshperry

Solution #2

It’s possible that the command screen -list is what you’re looking for.

See the man

Answered by Zoredache

Solution #3

While joshperry’s answer is correct, I find very annoying that it does not tell you the screen name (the one you set with -t option), that is actually what you use to identify a session. (not his fault, of course, that’s a screen’s flaw)

That’s why I prefer to use a script like this: grep -i screen|grep -v grep ps auxw

Answered by o0′.

Solution #4

I’m not sure what you’re asking, but if all you want is a list of currently open screen sessions, try:

screen -ls

Answered by skinp

Solution #5

 For windows system

 Open putty 
 then login in server

If you wish to see the screen in the console, type command.

 Screen -ls

If you need to access the screen, type the following command.

 screen -x screen id

PWD is a command that will tell you the folder you are currently in.

Answered by Ankit jain

Post is based on