------------------------------------------------------------
revno: 448
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Sun 2007-06-03 20:54:24 +1000
message:
  merged from ronnie
modified:
  common/ctdb.c                  ctdb.c-20061127094323-t50f58d65iaao5of-2
  config/ctdb.init               ctdb.init-20070527204758-biuh7znabuwan3zn-6
  tools/ctdb_control.c           
ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
    ------------------------------------------------------------
    revno: 432.1.12
    merged: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: Ronnie Sahlberg <[EMAIL PROTECTED]>
    branch nick: ctdb
    timestamp: Sun 2007-06-03 19:50:51 +1000
    message:
      add a -Y option to generate machine readable output.
      
      print 'ctdb status' in machinereadable form as
      :VNN:0|1:
    ------------------------------------------------------------
    revno: 432.1.11
    merged: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: Ronnie Sahlberg <[EMAIL PROTECTED]>
    branch nick: ctdb
    timestamp: Sun 2007-06-03 19:24:52 +1000
    message:
      ubuntu uses a different style of init scripts than redhat and suse
    ------------------------------------------------------------
    revno: 432.1.10
    merged: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: Ronnie Sahlberg <[EMAIL PROTECTED]>
    branch nick: ctdb
    timestamp: Sun 2007-06-03 18:59:27 +1000
    message:
      print an error message to stdout if we failed to open the logfile for 
      the daemon
    ------------------------------------------------------------
    revno: 432.1.9
    merged: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: Ronnie Sahlberg <[EMAIL PROTECTED]>
    branch nick: ctdb
    timestamp: Sun 2007-06-03 18:41:29 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 432.1.8
    merged: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: Ronnie Sahlberg <[EMAIL PROTECTED]>
    branch nick: ctdb
    timestamp: Sun 2007-06-03 17:07:23 +1000
    message:
      merge from tridge
=== modified file 'common/ctdb.c'
--- a/common/ctdb.c     2007-06-02 03:16:11 +0000
+++ b/common/ctdb.c     2007-06-03 08:59:27 +0000
@@ -52,12 +52,13 @@
        ctdb->logfile = talloc_strdup(ctdb, logfile);
        if (ctdb->logfile != NULL && strcmp(logfile, "-") != 0) {
                int fd;
-               close(1);
-               close(2);
                fd = open(ctdb->logfile, O_WRONLY|O_APPEND|O_CREAT, 0666);
                if (fd == -1) {
+                       printf("Failed to open logfile %s\n", ctdb->logfile);
                        abort();
                }
+               close(1);
+               close(2);
                if (fd != 1) {
                        dup2(fd, 1);
                        close(fd);

=== modified file 'config/ctdb.init'
--- a/config/ctdb.init  2007-06-03 07:53:26 +0000
+++ b/config/ctdb.init  2007-06-03 09:24:52 +0000
@@ -66,8 +66,11 @@
 
 if [ -x /sbin/startproc ]; then
     init_style="suse"
-else 
-    init_style="redhat"
+else if [ -x /sbin/start-stop-daemon ]; then
+       init_style="ubuntu"
+    else
+       init_style="redhat"
+    fi
 fi
 
 start() {
@@ -85,6 +88,10 @@
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
                return $RETVAL
                ;;
+           ubuntu)
+               start-stop-daemon --start --quiet --background --exec 
/usr/sbin/ctdbd -- $CTDB_OPTIONS
+               return $?
+               ;;
        esac
 }      
 

=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c      2007-05-31 03:50:53 +0000
+++ b/tools/ctdb_control.c      2007-06-03 09:50:51 +0000
@@ -32,6 +32,7 @@
 static struct {
        int timelimit;
        uint32_t vnn;
+       int machinereadable;
 } options;
 
 #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
@@ -288,6 +289,15 @@
                return ret;
        }
 
+       if(options.machinereadable){
+               printf(":Node:Status:\n");
+               for(i=0;i<nodemap->num;i++){
+                       printf(":%d:%d:\n", nodemap->nodes[i].vnn,
+                               !!nodemap->nodes[i].flags&NODE_FLAGS_CONNECTED);
+               }
+               return 0;
+       }
+
        printf("Number of nodes:%d\n", nodemap->num);
        for(i=0;i<nodemap->num;i++){
                printf("vnn:%d %s%s\n", nodemap->nodes[i].vnn,
@@ -723,6 +733,7 @@
 "Usage: ctdb [options] <control>\n" \
 "Options:\n" \
 "   -n <node>          choose node number, or 'all' (defaults to local node)\n"
+"   -Y                 generate machinereadable output\n"
 "   -t <timelimit>     set timelimit for control in seconds (default %u)\n", 
options.timelimit);
        printf("Controls:\n");
        for (i=0;i<ARRAY_SIZE(ctdb_commands);i++) {
@@ -747,6 +758,7 @@
                POPT_CTDB_CMDLINE
                { "timelimit", 't', POPT_ARG_INT, &options.timelimit, 0, 
"timelimit", "integer" },
                { "node",      'n', POPT_ARG_STRING, &nodestring, 0, "node", 
"integer|all" },
+               { "machinereadable", 'Y', POPT_ARG_NONE, 
&options.machinereadable, 0, "enable machinereadable output", NULL },
                POPT_TABLEEND
        };
        int opt;

Reply via email to