blob: 69e7bd40890cf2d2b98d30fc838d151c64a50a94 (
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.<replica 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
REPLICA=$1
if [ -z "${REPLICA}" ]
then
echo "Usage $0 replica_server"
fi
if [ "`ls -t $DUMPFILE.dump_ok $KDB_FILE | sed -n 1p`" = "$KDB_FILE" -o \
"`ls -t $DUMPFILE.${REPLICA}.last_prop $DUMPFILE.dump_ok | \
sed -n 1p`" = "$DUMPFILE.dump_ok" ]
then
date
$KDB5_UTIL dump $DUMPFILE > /dev/null
$KPROP -d -f $DUMPFILE ${REPLICA}
rm $DUMPFILE
fi
|