2010-03-17
Another building block of my environment: rxterm
Like many sysadmins using Unix workstations, I spend a lot of time
running xterms. Given that most of the time the remote X program I
start with my rxexec script is an xterm, it's
no surprise that I wrote another script to automate all of the magic
involved, called rxterm.
Rxterm's basic job is to start an xterm on a remote system with all of
the right options set for it; for instance, so that the xterm title
and icon title have the name of the system that xterm is logging on.
Like rxexec, rxterm has a number of options that are now vestigial
and unused (but still complicate the code).
(Some people set the terminal window title in their prompt. I don't like that approach for various reasons.)
If this was all that rxterm did, it would be a very short script.
However it has an additional option that complicates its life a lot:
'rxterm -r <host>' starts an xterm that is su'ing to root with
my entire environment set up in advance (because you cannot combine
xterm's -ls and -e arguments). Such xterms also get a special
title and are red instead of my usual xterm colours.
Setting up my environment is fairly complex, because the things I need
to do in the process of su'ing to root vary quite a lot from system to
system. On some of them I can just go straight to su, but on others I
need to run a cascade of scripts to get everything right. Rxterm has all
of the knowledge of which system needs what approach, so I don't have to
care. (Every now and then I need to tell it another exception.)
(In hindsight rxterm's approach to this problem is the wrong one,
but that's something for another entry.)
Every so often I consider giving rxterm an option so that it will
start a remote gnome-terminal instead of xterm. So far I keep not
doing this because gnome-terminal's command line options are so
different and the code isn't designed to cope with that, but by this
point rxterm has so many historical remnants that I should probably
rewrite it from scratch anyways.
(My short shameful confession here is that I had forgotten most of
rxterm's arguments until I actually looked at the shell script in the
process of writing this entry. Many probably don't work any more, and
one actually has the comment 'Doesn't work any more? I lack the time to
debug'.)