Wandering Thoughts archives

2010-07-17

More building blocks of my environment: tkrxterm, tkssh, and pyhosts

Given my rxterm and sshterm scripts, I need some way to run them in order to do useful things. The obvious thing to do is just to run them from the command line, but this requires that you have a command line sitting around and in my disposable environment this is generally not the case.

tkrxterm and tkssh are two very simple TCL/TK programs that do essentially the same thing. They each throw up a window with a label and a text entry field, let me enter text, and then run the appropriate command with the text as the arguments when I hit return in the text entry field. I have my window manager set to bring up an applications menu when the middle mouse button is pressed in the root window, and one or the other of these is the top entry on that menu.

(At home I pretty much only use sshterm, so it is the top entry; at work, I have enough bandwidth to use rxterm by preference.)

If I'm opening several windows on a single machine, though, it's kind of annoying to have to keep calling up one or the other of these programs. So I have a third command, pyhosts, which is designed to make it more convenient to repeatedly open windows on random machines. The easiest way to explain how it works is to show you that rarity on WanderingThoughts, a picture:

Pyhosts window

The empty area just below the top is a text entry field; the apps1 and mailswitch labels are buttons. If I enter a machine name in the text field and hit return, pyhosts starts an rxterm (or an sshterm if I flip it to do that) and adds a label button for the machine. Clicking on the label starts another rxterm or sshterm. Using shift-return (in the text entry field) or the middle mouse button (on the label button) runs rxterm -r to get a root shell instead of a normal shell. Machine labels are sorted in alphabetical order and only the most recently used four are kept, in order to keep the size of the window down.

(Because I am grimly decluttered in my computer interfaces, one can delete machine labels with the right mouse button and I routinely do so, reducing the pyhosts window to its minimum size.)

I am not sure that this pyhosts setup is the last word in getting decently convenient access to a reasonably large collection of random machines, especially given my flirtation with sshmenu and other hacks. However, I have not yet attempted to come up with a better approach.

(My normal full desktop environment isn't a Gnome desktop, so I can't just use sshmenu et al. Some day I will figure out how to have Gnome applets and Gnome's alert area without having to run all of Gnome.)

Credit where credit is due department: pyhosts is my adaptation of a program that I inherited from a previous coworker (who I believe may have inherited it from yet another coworker), because I saw it and thought it was a nifty idea. Most of the code is not my own.

(The chainsaw marks are my work.)

Sidebar: an interface that didn't work

I have experimented with hooking things up so that if I select a machine name (in the X selection sense) and call up a menu entry, it automatically runs an sshterm or rxterm to that machine. This sounds like it would be neat and convenient; you could do things like get email mentioning problems on machine X, highlight the machine's name in the email, pop up the menu, and bang, have a login on the machine to poke around.

In practice, I don't seem to run into this sort of scenario often enough to make this feature worth remembering. It was faster to just retype the machine name (or select and paste it, which is a couple of mouse clicks) than it was to find and invoke the special 'fast' way.

sysadmin/ToolsPyhosts written at 00:53:00; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.