Cover V04, I01
Article
Listing 1
Listing 2
Listing 3
Listing 4

jan95.tar


Remote Login Menus

Larry Reznick

One of the first things I do when I begin work for a client who has lots of systems and uses a window manager is set up a remote login menu. I go back and forth among remote systems as I find new fires to stamp out, and typing rsh or rlogin soon gets old. Besides, the ability to have a separate window for each system makes multiple parallel operations easy. This ease becomes especially important when the systems are disparate and my work entails comparing existing configurations with one another.

By preparing a systems menu and attaching it to the windowing desktop, you can easily select which system you want when you want it -- or multiple windows on the same system if you need that. The menu knows what commands and parameters to execute. Just select the system's name.

Each System a Window

In Sun's OpenWindows system, the window manager is olwm(1). When you start OpenWindows, it looks in your home directory for a hidden file called .openwin-menu. If there is no such file, olwm uses the default menu file, $OPENWINHOME/lib/openwin-menu. All users must have $OPENWINHOME defined in their environments. Specific submenus and programs are associated with the central openwin-menu. If you don't want the central menu's default settings or any of its submenus' settings, or you want to add to any of the menus, you must create your own. If you want everyone to have a menu different from the one documented, you could, of course, copy and change the central files. But that may not be a good idea.

The easiest way to create your own menu is to copy the central menu into your home directory:

cp $OPENWINHOME/lib/openwin-menu $HOME/.openwin-menu

With a private copy of .openwin-menu, change or add whatever you like. To keep the menus organized, create a subdirectory named ow in your home directory. All submenus will go there. The two submenus referred to by the central menu are named "openwin-menu-programs" and "openwin-menu-utilities." Copy those central submenu files into the ow subdirectory. I shortened their names as I copied them to ow-menu-prog and ow-menu-util. There will be one more submenu for the systems menu. Once the new menu is in your home directory, restart OpenWindows to activate it.

Menu Construction

Listing 1 shows the customized .openwin-menu file. The quoted words and phrases in the first field represent the menu item name. The name may be followed by identifying keywords, such as TITLE, which gives the menu window's title, or MENU, which identifies the name of a submenu.

When MENU appears it may be followed by the submenu text or by the name of a file containing the submenu information. In this case, "Programs" and "Utilities" do not refer to the central menu files; instead, the private .openwin- menu refers to my copies of them in my ow subdirectory. That way, the system will use the submenus with my private modifications.

Listing 2 shows the ~/ow/ow-menu-prog file as I modified it. If PIN is named next to the TITLE, a pushpin image appears on the title bar of the menu. Click the mouse on that pushpin and the menu will stay on the desktop until it's removed. That feature will be used in the systems submenu.

If the word DEFAULT appears next to a menu selection, that menu item is automatically selected if a user clicks on the submenu's name in the main menu without opening the submenu. When the submenu is opened, the DEFAULT item is highlighted. One of my complaints about the original programs menu was that cmdtool was set as the default. cmdtool is a text editor style shell window that keeps track of the previous user commands and program outputs, allowing scrolling back and forth. It uses more local system resources to keep track of all that than the shelltool and can slow down the local system. The only cmdtool I want on my screen is the console window. If I need a cmdtool for some special purpose, I'll start one from the menu. So, I made shelltool the default.

The only other change I made was to set the cmdtool and shelltool options to start in reverse video (-rv). The standard black lettering on white background -- a desperate attempt to make screens look like pieces of paper -- is too harsh on my eyes. On my laptop's LCD screen, this isn't a problem, but 20-inch CRTs with that much white blaring at me for too long hurts. The -rv option eliminates the problem by using white letters on a black background.

Listing 3 shows the customized ~/ow/ow-menu-util submenu. This illustrates how to embed a menu within the submenu file, rather than call another file containing the submenu commands. Notice that the submenu definition ends when a line repeating the MENU title line appears with the keyword END following it. The only change I made in this ow-menu-util submenu was to force the "Lock Screen" option to be the default so that I could simply select "Utilities" from the main menu to lock my screen when I walk away from it. I also added the -mode random to make the lock program interesting.

Back in Listing 1, the keyword SEPARATOR generates a blank line in the menu display. This blank line makes visual categorizing simple: single-space related items, skip a line to show some new relationship among items. I made sure that a SEPARATOR preceded and followed my "Systems" MENU option. SEPARATOR gets used often in the systems submenu to separate one group of systems from another. This new "Systems" option refers to a new file named to correspond with the other submenu files, ow-menu-sys.

System Menu

Listing 4 shows the ow-menu-sys submenu I created to launch the systems I was concerned with. This shows a lot of systems, but I wouldn't put many more in this submenu. Instead of adding more systems to this one, I'd keep a few important ones in this submenu and create more submenus to subclassify the other systems.

The systems in the top half, named level4 and level6 and the ones named after colors are all Sun systems. Those in the bottom half, named beginning with "hp" and beginning with "system," are Hewlett-Packard systems. level4 and level6 are the Sun servers, while the colored systems are regular workstations. level4 is labeled -s to identify it as the NIS slave server. level6 is labeled -m because it is the NIS master. hpserv and hpscd064 are the HP servers. The "system" machines are HP workstations, but those ending with a "t" are cluster stations served by the system named without the "t."

For each system named in the menu, I exec a shelltool when the menu item is selected. The -Wl (that's an "ell" after the "W," not a one) denotes the next argument as the window's label. Labeling the window with the system's name makes it very easy to see which window is on which system when many are cascaded across the screen.

When logging in to many remote systems is a workaday operation, setting up a systems menu can make the job simpler -- not only for you, but for coworkers, too. While I was explaining some details on my screen to a group manager, he asked about the little rectangle pinned to the side of my desktop. I explained the systems menu to him briefly and continued our discussion. Within an hour, he had copied the files discussed here and was happily clicking his way through the network.

About the Author

Larry Reznick has been programming professionally since 1978. He is currently working on systems programming in UNIX, MS-DOS, and OS/2. He teaches C, C++, and UNIX language courses at American River College and at the University of California, Davis extension.