summaryrefslogtreecommitdiffstats
path: root/src/slave/kslave_update
blob: a4da274ff538e5127b74d8ec307aaaca5d3e2780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#
# Propagate if database (principal.db) has been modified since last dump
# (dumpfile.dump_ok) or if database has been dumped since last successful
# propagation (dumpfile.<slave machine>.last_prop)

KDB_DIR=/usr/local/var/krb5kdc

KDB_FILE=$KDB_DIR/principal.db
DUMPFILE=$KDB_DIR/slave_datatrans
KDB5_UTIL=/usr/local/sbin/kdb5_util
KPROP=/usr/local/sbin/kprop

SLAVE=$1
if [ -z "${SLAVE}" ]
then 
  echo "Usage $0 slave_server"
fi

if [ "`ls -t $DUMPFILE.dump_ok $KDB_FILE | sed -n 1p`"  = "$KDB_FILE" -o \
     "`ls -t $DUMPFILE.${SLAVE}.last_prop $DUMPFILE.dump_ok | \
		sed -n 1p`"  = "$DUMPFILE.dump_ok" ]
then

	date
	$KDB5_EDIT dump $DUMPFILE > /dev/null

	$KPROP -d -f $DUMPFILE ${SLAVE}
	rm $DUMPFILE
fi