default log file to reasonable location
authorAndrew Tridgell <tridge@samba.org>
Tue, 29 May 2007 05:26:38 +0000 (15:26 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 29 May 2007 05:26:38 +0000 (15:26 +1000)
(This used to be ctdb commit 36b0a43c5d58d8171c1340603486e64051d696ac)

ctdb/common/cmdline.c
ctdb/direct/ctdbd.c
ctdb/packaging/RHEL/setup/ctdb.sysconfig

index dc0caa12f5ecdb9c38ffbedda43e1728f0f7a830..34e361e67221bc6b9361747900dcfb808fe52cd8 100644 (file)
@@ -36,7 +36,6 @@ static struct {
        int self_connect;
        const char *db_dir;
        int torture;
-       const char *logfile;
        const char *events;
 } ctdb_cmdline = {
        .nlist = ETCDIR "/ctdb/nodes",
@@ -46,7 +45,6 @@ static struct {
        .self_connect = 0,
        .db_dir = VARDIR "/ctdb",
        .torture = 0,
-       .logfile = NULL,
 };
 
 enum {OPT_EVENTSYSTEM=1};
@@ -74,7 +72,6 @@ struct poptOption popt_ctdb_cmdline[] = {
        { "debug", 'd', POPT_ARG_INT, &LogLevel, 0, "debug level"},
        { "dbdir", 0, POPT_ARG_STRING, &ctdb_cmdline.db_dir, 0, "directory for the tdb files", NULL },
        { "torture", 0, POPT_ARG_NONE, &ctdb_cmdline.torture, 0, "enable nastiness in library", NULL },
-       { "logfile", 0, POPT_ARG_STRING, &ctdb_cmdline.logfile, 0, "log file location", "filename" },
        { "events", 0, POPT_ARG_STRING, NULL, OPT_EVENTSYSTEM, "event system", NULL },
        { NULL }
 };
@@ -100,12 +97,6 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
                exit(1);
        }
 
-       ret = ctdb_set_logfile(ctdb, ctdb_cmdline.logfile);
-       if (ret == -1) {
-               printf("ctdb_set_logfile failed - %s\n", ctdb_errstr(ctdb));
-               exit(1);
-       }
-
        if (ctdb_cmdline.self_connect) {
                ctdb_set_flags(ctdb, CTDB_FLAG_SELF_CONNECT);
        }
index ff34a6d1d0eade8e6acbb9d76530ef2b2fc71fad..463e8f55342481bc31e4b47630c7e1bd88af68a5 100644 (file)
@@ -42,11 +42,14 @@ static struct {
        const char *public_address_list;
        const char *public_interface;
        const char *event_script;
+       const char *logfile;
 } options = {
-       .event_script = ETCDIR "/ctdb/events"
+       .event_script = ETCDIR "/ctdb/events",
+       .logfile = VARDIR "/log/log.ctdb"
 };
 
 
+
 /*
   main program
 */
@@ -62,6 +65,7 @@ int main(int argc, const char *argv[])
                { "public-addresses", 0, POPT_ARG_STRING, &options.public_address_list, 0, "public address list file", "filename" },
                { "public-interface", 0, POPT_ARG_STRING, &options.public_interface, 0, "public interface", "interface"},
                { "event-script", 0, POPT_ARG_STRING, &options.event_script, 0, "event script", "filename" },
+               { "logfile", 0, POPT_ARG_STRING, &options.logfile, 0, "log file location", "filename" },
                POPT_TABLEEND
        };
        int opt, ret;
@@ -94,6 +98,12 @@ int main(int argc, const char *argv[])
 
        ctdb = ctdb_cmdline_init(ev);
 
+       ret = ctdb_set_logfile(ctdb, options.logfile);
+       if (ret == -1) {
+               printf("ctdb_set_logfile to %s failed - %s\n", options.logfile, ctdb_errstr(ctdb));
+               exit(1);
+       }
+
        if (options.public_interface) {
                ctdb->takeover.interface = talloc_strdup(ctdb, options.public_interface);
                CTDB_NO_MEMORY(ctdb, ctdb->takeover.interface);
index 7dd49877cfa044c1c7c575008d4b50990cec4e4e..478a6e61445977a030a1a34203d00f27fbd363ac 100644 (file)
@@ -1,8 +1,7 @@
 # Options to ctdbd
-CLUSTER_NODES=/etc/samba/cluster_nodes.txt
-PUBLIC_ADDRESSES=/etc/samba/public_addresses.txt
+CLUSTER_NODES=/etc/ctdb/nodes
+PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
 PUBLIC_INTERFACE=eth0
-#CTDB_PORT=9001
 #LOGFILE=/var/log/samba/log.ctdb
 #DEBUGLEVEL=0