summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-04-05 13:43:56 +0200
committerMichael Adam <obnox@samba.org>2011-04-05 13:43:56 +0200
commitfaa6d8d7e2823ef4d06fa5384d6330067a95b5b7 (patch)
treed27b46d64319bd3ae598c9bd65ba531b28e804da
parenta5a6140b7ee736c733d67777d6865714cac28870 (diff)
downloadsamba-faa6d8d7e2823ef4d06fa5384d6330067a95b5b7.tar.gz
samba-faa6d8d7e2823ef4d06fa5384d6330067a95b5b7.tar.xz
samba-faa6d8d7e2823ef4d06fa5384d6330067a95b5b7.zip
ctdb.init: check for availability of "tdbtool check" and "tdbdump"
Print a warning if neither is available. (This used to be ctdb commit 4137d2a7d31cdce22847cebfc0239cfe2d8e937c)
-rwxr-xr-xctdb/config/ctdb.init28
1 files changed, 26 insertions, 2 deletions
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init
index 25e158fcc5..be730cd394 100755
--- a/ctdb/config/ctdb.init
+++ b/ctdb/config/ctdb.init
@@ -114,8 +114,6 @@ build_ctdb_options () {
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
@@ -146,6 +144,32 @@ check_persistent_databases () {
test x"$ERRCOUNT" != x"0" && {
return 0;
}
+
+ if test -x /usr/bin/tdbtool ; then
+ HAVE_TDBTOOL=1
+ else
+ HAVE_TDBTOOL=0
+ fi
+
+ if test x"$HAVE_TDBTOOL" = x"1" ; then
+ TDBTOOL_HAS_CHECK=`echo "help" | /usr/bin/tdbtool | grep check | wc -l`
+ else
+ TDBTOOL_HAS_CHECK=0
+ fi
+
+ if test -x /usr/bin/tdbdump ; then
+ HAVE_TDBDUMP=1
+ else
+ HAVE_TDBDUMP=0
+ fi
+
+ if test x"$HAVE_TDBDUMP" = x"0" -a x"$TDBTOOL_HAS_CHECK" = x"0" ; then
+ echo "WARNING: Cannot check persistent databases since"
+ echo "neither 'tdbdump' nor 'tdbtool check' is available."
+ echo "Consider installing tdbtool or at least tdbdump!"
+ return 0
+ fi
+
for PDBASE in `ls $PERSISTENT_DB_DIR/*.tdb.[0-9] 2>/dev/null`; do
check_tdb $PDBASE || {
echo "Persistent database $PDBASE is corrupted! CTDB will not start."