run in every screen window

der.hans PLUGd at LuftHans.com
Tue Aug 14 18:10:59 MST 2007


Am 11. Aug, 2007 schwätzte der.hans so:

moin moin,

OK, I have a way of doing this from inside screen.

At a screen command prompt ( <ctrl>-a : ), use the following:

at \# stuff "pwd^m"

This is an at command ( search in the manpage for 'altscreen' and then
page down to the next item ).

The '#' needs to be escaped and tells at to run against every other window
number in the screen session, stuff says to shove the subsequent command
into a buffer. The part in the quotes is the command to run.

I just learned this from someone who wrote a book on GNU/screen :).

http://www.lulu.com/content/491211

ciao,

der.hans

> moin moin,
>
> during Colin's great presentation on screen the question of running a
> command in every window of a screen instance came up.
>
> While I think tools like clusterssh and dsh are generally better tools
> there certainly might be specific reasons for using screen instead.
>
> clusterssh - administer multiple ssh or rsh shells simultaneously
> dsh - dancer's shell, or distributed shell
>
> See the bottom of this particular faq, http://aperiodic.net/screen/faq,
> about how to send commands to particular windows.
>
> screen -S PLUG -p0  -X exec top
> screen -S PLUG -p1  -X exec top
>
> I was able to run those and have them succeed to a disconnnected screen
> session, to a connected screen session from another screen session and
> from external to a screen session and also from within the affected screen
> session.
>
> I was not able to figure out how to get a window list from outside the
> screen session. In googling I came up with a couple of threads claiming
> it's impossible to get the list to STDOUT. They suggest instead writing it
> to a file, but I didn't see any info on how to do it.
>
> Maybe the screen-scraping Colin mentioned could be used to grab the output
> from <ctrl>-a " and build a list into a log. Googling for 'screen
> screen-scraping' doesn't really pull back what I was searching for :).
>
> ciao,
>
> der.hans
>

-- 
#  https://www.LuftHans.com/        http://www.CiscoLearning.org/
#  "If it's not a toy you're looking at it wrong." -- der.hans


More information about the PLUG-discuss mailing list