126236Swpaul#!/bin/sh
226236Swpaul#
326236Swpaul# This script is invoked by rpc.ypupdatedd to propagate NIS maps
426236Swpaul# after the master map databases have been modified. It expects
526236Swpaul# to be passed two arguments: the name of the map that was updated
626236Swpaul# and the name of the domain where the map resides.
726236Swpaul# These are passed to /var/yp/Makefile.
826236Swpaul#
926236Swpaul# Comment out the LOG=yes line to disable logging.
1026236Swpaul#
1150479Speter# $FreeBSD: releng/10.3/usr.sbin/rpc.ypupdated/ypupdate 50479 1999-08-28 01:35:59Z peter $
1226236Swpaul#
1326236Swpaul
1426236SwpaulLOG=yes
1526236SwpaulLOGFILE=/var/yp/ypupdate.log
1626236Swpaul
1726236Swpaulumask 077
1826236Swpaul
1926236Swpaulif [ ! -f $LOGFILE ];
2026236Swpaulthen
2126236Swpaul	/usr/bin/touch $LOGFILE
2226236Swpaul	echo "# Edit /usr/libexec/yppwupdate to disable" >> $LOGFILE
2326236Swpaul	echo "# logging to this file from yppasswdd." >> $LOGFILE
2426236Swpaul	echo -n "# Log started on: " >> $LOGFILE
2526236Swpaul	/bin/date >> $LOGFILE
2626236Swpaulfi
2726236Swpaul
2826236Swpaulif [ ! $LOG ];
2926236Swpaulthen
3026236Swpaul	cd /var/yp/$2; /usr/bin/make -f ../Makefile $1 2>&1
3126236Swpaulelse
3226236Swpaul	cd /var/yp/$2; /usr/bin/make -f ../Makefile $1 >> $LOGFILE
3326236Swpaulfi
34