[comp.mail.misc] Updating UUCP maps?

rsalz@bbn.com (Rich Salz) (02/22/90)

I use uuhosts to unpack the maps, and rebuild whenever any new maps
come in.  I ignore generally ignore news.config updates, but I read
them so that if someone complains about email problems, I have an
idea where to look.

Here's the first part of the script that's run nightly out of cron.
I particularly like the "elif echo ..." line.
	/r$

#! /bin/sh -vx
##  Script to build UUCP maps if the uuhosts Index file has been modified.
##  This script is in three major sections, each with its own config data.

##
##  PROLOG SECTION
##
PATH=/usr/uucp/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin: ; export PATH

##  Capture output.
if [ "$1" = "" ] ; then
    exec >/usr/uucp/bin/make-uucp-maps.out 2>&1
fi
cd /usr/spool/ftp/uumap/comp.mail.maps
echo "Started map script on `date`."

##  Ensure the index file exists; if it does, and it's new, make new maps.
uuhosts -unbatch
if [ ! -r Index ] ; then
    echo "Rebuilding uuhosts index file."
    uuhosts -i
elif echo "COSTS PATHS: Index; @/bin/false" | make -qf - ; then
    exec echo "No new map data."
fi


##
##  PATHALIAS SECTION
##
echo "Starting pathalias on `date`."

##  Dead machines and links.
DEAD=""

##  Overloaded machines and links.
AVOID=""

##  Debugging.
TRACE=""
DEBUG="-vvv ${TRACE}"

##  The path files.  First read local updates like u.BBN, then read the
##  domain files, then the raw map files.
P1="u.[A-Z]*"
P2="d.*"
P3="u.[a-z]*"
PATHS="${P1} ${P2} ${P3}"

##  Crunch, crunch
pathalias -i -c ${DEBUG} ${DEAD} ${AVOID} ${PATHS} |\
	awk '{ printf "%s\t%s\t%s\n", $2, $1, $3 }' >COSTS
awk '{ printf "%s\t%s\n", $1, $3 }' <COSTS >PATHS
sort +1.0 -n -o COSTS COSTS
sort -f -o PATHS PATHS

-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.

jpoplaws@telesci.UUCP (Joseph E Poplawski) (02/23/90)

In article <52@dynasys.UUCP> jessea@dynasys.UUCP (Jesse W. Asher) writes:
>I just started using smail and I was wondering how often and how you
>updated your paths file?  It seems to be a waste to run pathalias
>everytime you get a new map, or a new site posted in news.newsite, or 
>a site update posted in news.config.  Do you actually use these when they 
>are posted to the net?  I realize that the most recent maps are posted 
>in comp.mail.maps, but do you wait to get all the maps before updating 
>the paths file?  How do you handle this and new sites posted in
>news.newsites and updates posted in news.config?  Thanx in advance.

Well here at fantasci, the paths file is re-generated every morning at 5:00a
and it usually lasts until about 6:30a.  This is the time when no-one is usually
on the machine and all uucp is shut off until it is complete.  This insures that
we always have the latest paths data on hand.  As for sites posted as new or
updated in any of the news.all groups, they are basically ignored unless they
are deemed extremely important (ie. updates for backbones like uunet or sites
that we connect to on a regular basis).  This is because if they are updated
or new, chances are they will be included in the next regular map file that
is posted in comp.mail.maps.

Hope this helps...

-Jo
--
...!princeton!pyrnj!telesci!fantasci!jep
jep@fantasci.uucp  jpoplaws@telesci.uucp
-- 
...!princeton!pyrnj!telesci!fantasci!jep
jep@fantasci.uucp  jpoplaws@telesci.uucp

dglo@saturn.ADS.COM (Dave Glowacki) (02/24/90)

To store the maps in compressed form (thus freeing up LOTS of disk space),
set COMPRESS=1 in uuhosts, then change the final lines in Rich's script to:

##  The path files.  First read local updates like u.BBN, then read the
##  domain files, then the raw map files.
P1="u.[A-Z]*"
P2="d.*"
P3="u.[a-z]*"

##  Print file name then file, so pathalias can report any errors correctly
(for i in ${P1} ${P2} ${P3}; do
	##  Handle both compressed and uncompressed (in case any maps
	##   were too small to be compressed efficiently)
	case $i in
	  *.Z)	echo "file {$i}"
		zcat $i ;;
	  *)	echo "file {$i}"
		cat $i ;;
	esac
	echo "private {}"
done) | pathalias -i -c ${DEBUG} ${DEAD} ${AVOID} |\
	awk '{ printf "%s\t%s\t%s\n", $2, $1, $3 }' >COSTS
awk '{ printf "%s\t%s\n", $1, $3 }' <COSTS >PATHS
sort +1.0 -n -o COSTS COSTS
sort -f -o PATHS PATHS