[PATCH] [CTDB] Added configurable logging directory

math.parent at gmail.com math.parent at gmail.com
Fri Nov 21 21:36:52 GMT 2008


From: Mathieu Parent <math.parent at gmail.com>

This is an updated version of http://lists.samba.org/archive/samba-technical/2008-October/061534.html

Which was not working because lacking autoconf part.

---
 Makefile.in    |    5 +++--
 configure.ac   |   12 +++++++++++-
 server/ctdbd.c |    2 +-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 779bd8b..86e4e9e 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,6 +12,7 @@ bindir = @bindir@
 sbindir = @sbindir@
 mandir = @mandir@
 localstatedir = @localstatedir@
+LOGDIR = @LOGDIR@
 VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@
 srcdir = @srcdir@
 etcdir = @sysconfdir@
@@ -29,8 +30,8 @@ IPQ_LIBS = @IPQ_LIBS@
 
 CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
        -I at tallocdir@ -I at tdbdir@/include -I at libreplacedir@ \
-	-DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
-	-DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS)
+	-DVARDIR=\"$(localstatedir)\" -DLOGDIR=\"$(logdir)\" \
+	-DETCDIR=\"$(etcdir)\" -DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS)
 
 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
 
diff --git a/configure.ac b/configure.ac
index d552eed..c27a2d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,17 @@ if test "$ac_cv_prog_gcc" = yes; then
    CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
 fi
 
+LOGDIR='${prefix}/var/log'
+AC_ARG_WITH([logdir],
+[  --with-logdir=DIR       path to log directory],
+    LOGDIR=$withval)
+if test ! -z "$LOGDIR"; then
+    if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then
+        AC_MSG_ERROR([--with-logdir must specify a path])
+    fi
+fi
+AC_SUBST(LOGDIR)
+
 AC_CONFIG_HEADER(config.h)
 
 EXTRA_OBJ=""
diff --git a/server/ctdbd.c b/server/ctdbd.c
index b95aaca..e2f0eb7 100644
--- a/server/ctdbd.c
+++ b/server/ctdbd.c
@@ -51,7 +51,7 @@ static struct {
 	.nlist = ETCDIR "/ctdb/nodes",
 	.transport = "tcp",
 	.event_script_dir = ETCDIR "/ctdb/events.d",
-	.logfile = VARDIR "/log/log.ctdb",
+	.logfile = LOGDIR "/log.ctdb",
 	.db_dir = VARDIR "/ctdb",
 	.db_dir_persistent = VARDIR "/ctdb/persistent",
 	.script_log_level = DEBUG_ERR,
-- 
1.5.6.5



More information about the samba-technical mailing list