Using GNU screen to access hundreds of hosts.
I have run into a dilemma, a limitation in GNU screen if you will, and I'm not sure if xterm-style escape sequences are going to solve my problem.
Background:
GNU Screen makes available many custom escape sequences that can be used to customize the status line. It will even allow you to capture output from a command, and substitute that output back into the status bar.
What I want to do:
I tend to start up a screen session, and then create one window for every host that I want to ssh into. I would love, automatically, that whenever I ssh into a destination host in one of my screen windows, that the *destination* hostname be available as a macro for use in my status bar. I believe that if I try to set the status bar with the status escape (ESC_stringESC\) or xterm escape, that I will replace the *entire* contents of the status line.
Instead, what I want is for the status line to be updated similar to the following:
1. Log into hostA and run screen
2. Hardstatus line now looks like this:
7-22-2011 3:04 P.M. | hostA
3. From within the same screen window, ssh into hostB
4. Hardstatus line now looks like this automatically:
7-22-2011 3:05 P.M. | hostB
5. I do some work, then log out
6. Hardstatus line resets to:
7-22-2011 3:11 P.M. | hostA
Is this even possible? If so, how would I achieve it? I am sensing that if it is doable, I'm going to need to set up some shell magic whenever I invoke ssh.
I am posting this in the Enterprise forums because this could be very useful for folks who manage dozens to thousands of servers.
Thanks!
P.S. Yes, I do realize that host information can easily be placed into the shell prompt, but there are occasions where the shell prompt is not visible.
|