xref: /freebsd/usr.sbin/rpc.ypupdated/ypupdate (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
140a5f74dSBill Paul#!/bin/sh
240a5f74dSBill Paul#
340a5f74dSBill Paul# This script is invoked by rpc.ypupdatedd to propagate NIS maps
440a5f74dSBill Paul# after the master map databases have been modified. It expects
540a5f74dSBill Paul# to be passed two arguments: the name of the map that was updated
640a5f74dSBill Paul# and the name of the domain where the map resides.
740a5f74dSBill Paul# These are passed to /var/yp/Makefile.
840a5f74dSBill Paul#
940a5f74dSBill Paul# Comment out the LOG=yes line to disable logging.
1040a5f74dSBill Paul#
1140a5f74dSBill Paul#
1240a5f74dSBill Paul
1340a5f74dSBill PaulLOG=yes
1440a5f74dSBill PaulLOGFILE=/var/yp/ypupdate.log
1540a5f74dSBill Paul
1640a5f74dSBill Paulumask 077
1740a5f74dSBill Paul
1840a5f74dSBill Paulif [ ! -f $LOGFILE ];
1940a5f74dSBill Paulthen
2040a5f74dSBill Paul	/usr/bin/touch $LOGFILE
2140a5f74dSBill Paul	echo "# Edit /usr/libexec/yppwupdate to disable" >> $LOGFILE
2240a5f74dSBill Paul	echo "# logging to this file from yppasswdd." >> $LOGFILE
2340a5f74dSBill Paul	echo -n "# Log started on: " >> $LOGFILE
2440a5f74dSBill Paul	/bin/date >> $LOGFILE
2540a5f74dSBill Paulfi
2640a5f74dSBill Paul
2740a5f74dSBill Paulif [ ! $LOG ];
2840a5f74dSBill Paulthen
2940a5f74dSBill Paul	cd /var/yp/$2; /usr/bin/make -f ../Makefile $1 2>&1
3040a5f74dSBill Paulelse
3140a5f74dSBill Paul	cd /var/yp/$2; /usr/bin/make -f ../Makefile $1 >> $LOGFILE
3240a5f74dSBill Paulfi
33