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