In message <[EMAIL PROTECTED]>you write:
>Does anyone have a solution to the problem of keeping
>/usr/vice/etc/CellServDB up-to-date on all your AFS clients?
We run this cron job nightly:
#!/bin/sh
# last mod November 1992 [EMAIL PROTECTED]
# merge in CellServDB from global location(s) and localhost.
#
### Important: do NOT echo any output on RS/6K except on error. -mdw
PATH=/usr/ucb:/bin:/usr/bin:/usr/vice/bin:/etc
export PATH
: general configuration
hostname=`hostname`
admin=$1
case $admin in
"")
admin=/afs/umich.edu/group/itd/umich/admin
;;
esac
if [ -f /usr/vice/etc/.dontupdate ]
then
exit 0
fi
: find some cellservdbs
if [ -f $admin/cellservdb/$hostname/CellServDB ]
then
cdbs="$admin/cellservdb/$hostname/CellServDB"
else
cdbs="$admin/cellservdb/default/CellServDB"
fi
if [ -f /usr/vice/etc/CellServDB.local ]
then
cdbs="$cdbs /usr/vice/etc/CellServDB.local"
fi
: merge cellservdbs in - last entry for given cell wins
#test: cdbs="$cdbs /afs/nosuchnost/nosuchfile"
cellservdb=/usr/vice/etc/CellServDB.new
if awk 'BEGIN{ RS=">"; ncells = 0; set[0] = ""; }
{if ($1 != "") {
if (reset[$1] == 0) { ncells++; set[ncells] = $1; reset[$1] = ncells; }
data[$1] = $0 } }
END{for (x = 1; x <= ncells; ++x) { printf "%s", ">" data[set[x]]}}' $cdbs >$cellservdb
then
: all is ok so continue
else
echo awk failed so CellServDB update run aborted >&2
exit 1
fi
: if it worked update client and kernel
if [ -s $cellservdb ]
then
cp $cellservdb /usr/vice/etc/CellServDB
rm $cellservdb
cellservdb=/usr/vice/etc/CellServDB
touch /usr/vice/etc/ThisCell
# /usr/etc/recell
# (our goal: convert CellSErvDB into shell script and execute it)
# (make it "sh -v" if you want to see the commands...)
sed '/^>/{
x
/ /{
s/^/fs newcell /
p
}
x
s/^>\([^ ]*\).*/\1/
h
d
}
s/[ ].**//
x
G
s/\n/ /g
h
${
g
/ /{
s/^/fs newcell /
p
}
}
d
' $cellservdb | sh
else
echo bad cellServDB.new so CellServDB update run aborted >&2
exit 1
fi
exit 0
--------
Sarr Blumson [EMAIL PROTECTED]
voice: +1 313 764 0253 FAX: +1 313 763 4434
CITI, University of Michigan http://www.citi.umich.edu:80/users/sarr/
519 W William, Ann Arbor, MI 48103-4943