Jump to content

monitoring "screen"


Recommended Posts

I use the "screen" command a lot because I'm not always at my linux machine, but I can use SSH to access it from anywhere, so I can for example start a bittorrent download, an FTP download and restart my UT2004 server remotely and monitor them from somewhere else.

 

So I often have multiple screen sessions going (I'm downloading 3 different liveCDs as I type this for example).

 

I often want to check on all sessions at some time, for example to see how much time is left on a download, or if my game server is busy.

 

 

I don't know of a way to skip form one session to another from within screen, so I have to retype "screen -d -r xxxxx.pts-y.Mandrake" where xxxxx is the session number and y the terminal number. Is this truly not possible? it would be so convenient if you could press Ctrl-A + a key and mvoe to the next session.

 

 

Also, I'd like to have a cron job send me a status of the screen sessions, such as making sure that the torrents I'm seeding are still conencted to their tracker, or whatever.

Ideally I'd liketo simple capture a "snapshot" of a screen session to a file by simply issuing a command line. Is this possible at all?

 

 

I did read the screen man page, but for whatever reason most of it just doesn't register with my brain, for exampel from the man page I thoguh Ctrl-A + n would do exactly what I describe in my first question.

Link to comment
Share on other sites

If you start just one screen session and just create a new window for each command, you could do Ctrl-a <n> to switch between windows and then you only have one screen session to detach/reattach and deal with.

 

To create a new window:

 

Ctrl-a Ctrl-c

 

There's a way to name your windows, too, but I would have to look at 'man screen' a little longer to be able to help you there. As far as logging...I dunno, but I'm sure it's possible. When I get the time, I'll play around with it.

Link to comment
Share on other sites

I did read the screen man page, but for whatever reason most of it just doesn't register with my brain, for exampel from the man page I thoguh Ctrl-A + n would do exactly what I describe in my first question.

Read what it says.

 

Ctrl+A,Ctrl+N = next window

Ctrl+A,Ctrl+P = previous window

Ctrl+A,0 = 1st window

Ctrl+A,1 = 2nd window

and so on. (Ctrl-A + n was meant to be a number)

Link to comment
Share on other sites

hokai

currently you are using multiple different sessions, one for each command. you want to use one session for all of them.

 

in future start a command line with screen -D -R

 

this will start your session. Then run your command to do whatever. to add another command prompt to the session, press ctrl-a and then 'c' this will pop up a new command line. do whatever you like there. to swap between them, do ctrl-a, and then spacebar.

 

When you want to reattatch the session so you can access it, manipulate it, whatever, do: screen -D -R again.

 

iphitus.

Link to comment
Share on other sites

  • 1 month later...

If you use separate windows instead of separate instances of screen, you can monitor them like this:

 

screen

Ctrl-a H <<starts logging output from that window to screenlog.0>>

btdownloadheadless.py <<whatever>>

Ctrl-a c <<starts a new window and switches to that window>>

Ctrll-a H <<starts logging output from that window to screenlog.1>>

btdownloadheadless.py <<whatever>>

Ctrl-a d <<detaches window>>

 

You can now see the output of each screen window with

cat screenlog.<<window#>>

 

Note that only the output of the windows is sent to the screenlog. The log seems all screwy if you use btdownloadcurses, which is why I suggest btdownloadheadless.py

Edited by Steve Scrimpshire
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...