Oh and there's a quick catch to make sure the file looks vaguely sane before distributing it, just in case something bad happens with the nodels...
#!/bin/bash
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/opt/xcat/bin
GROUP=foo
OUTPUT=/install/data/$GROUP/etc/hosts.equiv
DOMAIN=baa.cluster
MASTER=xcatmaster
date=`date`
cat <<- EOT > $OUTPUT
# autogenerated
# on $date
$MASTER
$MASTER.main.cluster
$MASTER-foo
$MASTER-foo.$DOMAIN
EOT
for node in `nodels $GROUP`; do
cat <<- EOT >> $OUTPUT
$node
$node.$DOMAIN
EOT
done
WC=`wc -l $OUTPUT | awk '{print $1}'`
if [ $WC -lt 12 ]; then
echo "WARNING: Unexpcted number of lines in $OUTPUT"
else
xdcp $GROUP -Q $OUTPUT /etc/hosts.equiv
fi
No comments:
Post a comment