Current Issue


Table of contents

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 12.0

Version 12.0 delivers every issue of Sys Admin from 1992 through 2006 and every
issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!

Sys Admin Magazine > Archives > 2007 > April 2007

SortingHat -- Which Server Do You Belong In?

John Spurgeon and Ed Schaefer

We are responsible for administering several servers distributed around the world. Each server is configured more or less the same way. However, a variety of attributes are unique to a particular server: nodename, IP address, default router, etc.

We developed a utility called changeident (Spurgeon & Schaefer, 2004) to facilitate the configuration of many server-specific parameters. The modules that comprise changeident typically update or replace existing files using variables and hard-coded logic. For example, changing the nodename of a server involves commands like "echo $new_nodename > /etc/nodename".

Some files, such as users' crontab files, are too complex for this approach. Instead, we use a Korn Shell script called SortingHat (see the sidebar "What's in a Name?"). SortingHat replaces existing files with copies of files that are preconfigured for specific servers.

The Directory Structure

The SortingHat script ( Listing 1 ) makes use of several directories to manage and organize files:

SORTINGHAT_DIR=/opt/SortingHat
SERVERS_DIR=$SORTINGHAT_DIR/servers
DEFAULT_DIR=$SORTINGHAT_DIR/default
BACKUP_DIR=$SORTINGHAT_DIR/backup
CURRENT_DIR=$SORTINGHAT_DIR/current
The "servers" directory contains several subdirectories. The name of a subdirectory is the hostname of a server. And each of these subdirectories may contain more subdirectories and files. For example, a copy of the hosts.equiv file for a server named pongo would be located at:

/opt/SortingHat/servers/pongo/etc/hosts.e

				  



MarketPlace

Free Download Speeds Up PCs
Make Your PC Faster --New Diskeeper 2008 Speeds Up PCs --Download Free Trial Now!

Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.

Automate Software Builds with Visual Build Pro
Easily create an automated, repeatable process for building and deploying software.

WinDev 12 - Powerful IDE
Develop 10 times faster ! ALM, IDE, .Net, RAD, 5GL, Database, 5GL, 64-bit, etc. Free Express version

Wanna see your ad here?