LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 07-26-2011, 03:44 PM   #1
larold
Member
 
Registered: Jan 2010
Posts: 42

Rep: Reputation: 15
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.
 
Old 07-26-2011, 06:00 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Not really a direct answer but have you looked at func? .. supports plugins, great for running arbitrary commands against any hostname glob ( p[1-9]dns.domain.tld, *.domain.tld ... etc ) but it may be that what you're doing is more interactive.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to use GNU screen. backspace makes screen flash. twelvenine Linux - Software 5 08-07-2009 08:37 PM
can't restrict sshd access through hosts.allow and hosts.deny but was working earlier farhan Linux - Security 4 04-18-2008 07:41 AM
installing screen(http://www.gnu.org/software/screen/) dreamlemon Solaris / OpenSolaris 5 09-29-2007 03:36 PM
/etc/hosts.deny/hosts.allow have no effect on sshd access bganesh Linux - Security 4 05-04-2006 08:06 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration