run in every screen window

der.hans PLUGd at LuftHans.com
Sat Aug 11 13:13:18 MST 2007


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/
#  ... All true wisdom is found on T-shirts.


More information about the PLUG-discuss mailing list