xref: /freebsd/usr.sbin/rpc.ypupdated/ypupdate (revision 1669d8afc64812c8d2d1d147ae1fd42ff441e1b1)
1#!/bin/sh
2#
3# This script is invoked by rpc.ypupdatedd to propagate NIS maps
4# after the master map databases have been modified. It expects
5# to be passed two arguments: the name of the map that was updated
6# and the name of the domain where the map resides.
7# These are passed to /var/yp/Makefile.
8#
9# Comment out the LOG=yes line to disable logging.
10#
11# $FreeBSD$
12#
13
14LOG=yes
15LOGFILE=/var/yp/ypupdate.log
16
17umask 077
18
19if [ ! -f $LOGFILE ];
20then
21	/usr/bin/touch $LOGFILE
22	echo "# Edit /usr/libexec/yppwupdate to disable" >> $LOGFILE
23	echo "# logging to this file from yppasswdd." >> $LOGFILE
24	echo -n "# Log started on: " >> $LOGFILE
25	/bin/date >> $LOGFILE
26fi
27
28if [ ! $LOG ];
29then
30	cd /var/yp/$2; /usr/bin/make -f ../Makefile $1 2>&1
31else
32	cd /var/yp/$2; /usr/bin/make -f ../Makefile $1 >> $LOGFILE
33fi
34