[comp.sys.sun] Whois Server

miker@central.sun.com (Mike Raffety) (04/22/89)

Sometimes the simplest solutions are best.  We have a flat file set up on
a master server, which is "rdist"ed out to our primary servers.
("rdist(1)" is an absolutely INVALUABLE utility; if you've never heard of
it, take a few minutes to read the man page.)

All machines mount the filesystem with the file (and lots of other stuff)
from a primary server.  Then, we have the "phone" command (a shell script)
to, basically, do a "grep" through the flat file.  This file contains
names, phone extensions, login name, home phone number, and beeper number,
one line per person, along with a little other commonly useful info.  Note
that phone supports the concept of local and group phone lists, too, and
that you can use it to do reverse directory lookups.

The phone script follows:
#!/bin/sh
#
#	@(#)phone.sh	1.2	2/2/88
#

# The phone lists are located here:
main_list=/run/usr/lib/phone_list
my_lists="$main_list ${PHONE_LIST-${HOME}/phone_list}"

#  See if we have a command line argument; if not, prompt for one
if [ $# -eq 0 ] ; then
	echo -n "Enter name or number: " ;
	read a ;
else
	a="$*" ;
fi

# Look in the lists
for list in ${my_lists} ; do
	if [ -r ${list} ] ; then
		grep -i -h -e "$a" ${list} ;
	fi ;
done