Xref: utzoo comp.mail.misc:1049 news.sysadmin:773
Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!husc6!psuvax1!psuhcx!wcf
From: wcf@psuhcx.psu.edu (Bill Fenner)
Newsgroups: comp.mail.misc,news.sysadmin
Subject: Re: My script for mapfiles/pathalias updating
Keywords: pathalias, maps, update, script
Message-ID: <190@psuhcx.psu.edu>
Date: 27 Jun 88 01:22:11 GMT
References: <957@flatline.UUCP>
Reply-To: wcf@psuhcx (Bill Fenner)
Organization: Penn State University
Lines: 98

We use something slightly different here.  Instead of going through all
the /usr/spool/news/comp/mail/maps files, we have in our sys file

UUMAP:world,comp.mail.maps::/usr/lib/news/uumap

where /usr/lib/news/uumap is

#!/bin/sh
#
# uumap - unpack the usenet maps
#
umask 002
cd /usr/spool/uumap
/bin/sed -f /usr/lib/news/sedfile | /usr/local/bin/unshar
/usr/local/bin/compress -f *[0-9]

/usr/lib/news/sedfile is:

1,/^$/d
/^$/d
/^#/d

The first line strips the header, the second strips blank lines, and the
third strips comments (we don't have much disk space), and then it compresses
it.  We also use unshar instead of sh just in case someone posts something
like rm -r / to comp.mail.maps (not too horribly hard.)  I wonder how many
sites would go kaplooey after that happened, if it did?

Then every once in a while we run this.

#!/bin/sh
#
#  mkpaths  -- make a new pathalias "paths" file for smail
#
USAGE="Usage: mkpaths [-e errlogfile ]"

PATH=:/bin:/usr/bin:/usr/local/bin; export PATH

# where are the map files?
mapdir="/usr/spool/uumap"
# list of map files to use
mapfiles="d.* u.usa.* u.can.* Paths.*"
# where to place paths file (if -c given)
pathfile="/usr/lib/uucp/paths"
# default errlog file (if no -e)
deflog="/usr/lib/uucp/mkpaths.log"
# file that contains any dead links
deadfile="DEAD"

cd ${mapdir}

# parse command line
set -- `getopt cp:e: $*`
if [ $? != 0 ]; then
	echo ${USAGE}
	exit 2
fi
COPYTO=""
PATHSFILE=${pathfile}
ERRLOG=${deflog}
for i in $*
do
	case ${i} in
	   -e)  ERRLOG=${2}; shift; shift
		;;
	   --)  shift; break
		;;
	esac
done

uncompress * 2>${ERRLOG}

# get any dead links
list=""
if [ -r ${deadfile} -a -s ${deadfile} ]; then
	dead=`cat ${deadfile}`
	for sys in ${dead}
	do
		list="${list} -d ${sys}"
	done
fi

# run the sucker
(pathalias -v ${list} ${mapfiles} | sort > ${PATHSFILE}) 2>>${ERRLOG}

compress -f * 2>>${ERRORLOG}

exit 0

I got these scripts off the net somewhen a while back, and added some things
to compensate for our lack of disk space.  Anybody want to comment on this
one?

-- 
    Bitnet: wcf@psuhcx.bitnet     Bill Fenner     | "How can we dance
   Internet: wcf@hcx.psu.edu                      |  When the beds are burning"
  UUCP: {gatech,cmcl2,rutgers}!psuvax1!psuhcx!wcf |
 Fido: Sysop at 263/42                            | Now wait a second . . .