MkMapData.sh
John Burgess - Local tools ADM
ladm at kitc.UUCP
Tue Aug 27 03:29:08 AEST 1985
# this is NOT a SHAR - see article posted to net.news,net.mail
# for info about this shell.
# also watch for .signature at end!
# --- cut here ---
# shell to generate uucpmap source information for local machine
# usage: MkMapData [ 'new' ] [ 2-digit-month ]
# new - regenerates entire list from uuname
# month - overrides current month analysis
cd /usr/spool/uucpmap
TMP=/tmp/mkmap$$
cp MapData OLDMapData
if [ "$1" = new ]
then
# initial list comes from uuname; assume erratic connection
# throw out local systems; convert to canonical UUCP format
# (all lower case, max 6 char names)
uuname | egrep -v 'LOCAL SYSTEMS' |
tr "[A-Z]" "[a-z]" | sort |
sed -e '/^\(......\)..*$/s//\1/' \
-e 's/^.*$/ &(WEEKLY),/' >${TMP}
ed - MapData <<-EOF
/^`uname` /+;/^\$/-d
-r ${TMP}
s/,//
w
EOF
shift
fi
# generate modifications based on recent experience
# don't replace unusual entries (those with '+', '-', etc.)
# use g/.../ so that it can't fail
now=${1-`date +%m`}
uustat -mall | grep " $now/" |
sed -n -e 's/ .* / /' \
-e '/LOCAL SYSTEMS/d' \
-e 's@\(.*\) BAD SYSTEM at g/ \1(/s/([A-Z]*)/(DEAD)/@p' \
-e 's@\(.*\) CONVERSATION SUCCEEDED at g/ \1(/s/([A-Z]*)/(DEMAND)/@p' \
-e 's@\(.*\) [A-Z]* FAILED at g/ \1(/s/([A-Z]*)/(DEAD)/@p' \
>${TMP}
echo 'w' >>${TMP}
# apply uustat modifications; then "local wisdom" overrides.
ed - MapData <${TMP}
ed - MapData <<-EOF
g/LOCAL SYSTEMS/s/DEMAND/DIRECT/
/ihnp4/s/+*L*O*W*)/+LOW)/
w
EOF
# if running from terminal, report changes
test -t 1 && diff OLDMapData MapData
rm ${TMP}
--
John Burgess - Local Tools Administrator
ATT-IS Labs, So. Plainfield NJ (HP 1C-221)
{most Action Central sites}!kitc!ladm
(201) 561-7100 x2481 (8-259-2481)
More information about the Comp.sources.unix
mailing list