Listing: tl
#!/usr/bin/perl -w
use strict;
$|++;
my $host=`/bin/hostname`;
chomp $host;
while(1) {
open(LOAD,"/proc/loadavg") || die "Couldn't open /proc/loadavg: $!\n";
my @load=split(/ /,<LOAD>);
close(LOAD);
print "\033]0;";
print "$host: $load[0] $load[1] $load[2] at ", scalar(localtime);
print "\007";
sleep 2;
}
When you'd like to have your titlebar replaced with
the name, load average, and current time of the machine
you're logged into, just run
tl&. It will happily go on running in the
background, even if you're running an interactive
program like vim. If you have your titlebar
already set to show the current working directory, no problem. When
you cd, the current working directory is flashed
momentarily, and then replaced with the time and load average again.
Need to see that directory one more time? Just hit Enter on a blank
line, and it will flash again.
Now instead of spreading terminals around and completely covering
your desktop, you can stack a pile of them together (leaving only
your titlebars showing), and enjoy an "at a
glance" view of how hard each machine is working.
When you need to work on a machine, just bring that window to the
foreground, and immediately begin working. Of course, this is all
available to you without installing a single piece of software on
your local machine.
When you're finished, don't forget
to killall tl before logging out. Or if
you're terminally lazy, try this:
$ echo 'killall tl > /dev/null 2>&1' >> ~/.bash_logout
That will kill all of your running tl jobs on
logout, without even having to lift a finger. System administration
just keeps getting easier, doesn't it?
Anyone understand whats wrong?
Tim.