mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
merged from ronnie
(This used to be ctdb commit 02b7781c29c2a63d236bd38b3a19af2af8e57a72)
This commit is contained in:
commit
6eaa5c69e9
@ -52,12 +52,13 @@ int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile)
|
||||
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);
|
||||
|
@ -66,8 +66,11 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
|
||||
|
||||
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 @@ start() {
|
||||
[ $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
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ static void usage(void);
|
||||
static struct {
|
||||
int timelimit;
|
||||
uint32_t vnn;
|
||||
int machinereadable;
|
||||
} options;
|
||||
|
||||
#define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
|
||||
@ -288,6 +289,15 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
|
||||
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 @@ static void usage(void)
|
||||
"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 @@ int main(int argc, const char *argv[])
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user