1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

config: try to use tdbtool <tdb> check instead of tdbdump for persistent db checks

metze

(This used to be ctdb commit 52e6d81f4d8a4035272d9256d01bafb8ed593027)
This commit is contained in:
Stefan Metzmacher 2009-12-07 10:46:10 +01:00
parent a03cf0040b
commit 0c735f03d4

View File

@ -105,11 +105,35 @@ build_ctdb_options () {
maybe_set "--syslog" "$CTDB_SYSLOG" "yes"
}
check_tdb () {
local PDBASE=$1
local TDBTOOL_HAS_CHECK=`echo "help" | /usr/bin/tdbtool | grep check | wc -l`
test x"$TDBTOOL_HAS_CHECK" = x"1" && {
#
# Note tdbtool always exits with 0
#
local OK=`/usr/bin/tdbtool $PDBASE check | grep "Database integrity is OK" | wc -l`
test x"$OK" = x"1" || {
return 1;
}
return 0;
}
/usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
return $?;
}
return 0;
}
check_persistent_databases () {
PERSISTENT_DB_DIR="${CTDB_DBDIR:-/var/ctdb}/persistent"
mkdir -p $PERSISTENT_DB_DIR 2>/dev/null
for PDBASE in `ls $PERSISTENT_DB_DIR/*.tdb.[0-9] 2>/dev/null`; do
/usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
check_tdb $PDBASE || {
echo "Persistent database $PDBASE is corrupted! CTDB will not start."
return 1
}