diff options
author | Koichi Suzuki | 2013-01-18 08:48:26 +0000 |
---|---|---|
committer | Koichi Suzuki | 2013-01-18 08:48:26 +0000 |
commit | 010628d2ae2ff57703ccc7fea9a0309bb4d43d14 (patch) | |
tree | 48b024ca1561d2e31a7a787808ec1f7a3e011eb8 | |
parent | cd49a23cf12a27bd5723ac757b315545824dc586 (diff) |
This commit improves gtm_ctl status behavior as described in the
reference manual. Now for -Z gtm option, gtm_ctl status displays
if it runs as master or slave.
modified: src/bin/gtm_ctl/gtm_ctl.c
-rw-r--r-- | src/bin/gtm_ctl/gtm_ctl.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bin/gtm_ctl/gtm_ctl.c b/src/bin/gtm_ctl/gtm_ctl.c index 9f2143c0d2..200cd01579 100644 --- a/src/bin/gtm_ctl/gtm_ctl.c +++ b/src/bin/gtm_ctl/gtm_ctl.c @@ -768,11 +768,14 @@ do_status(void) exit(1); } - if (fscanf(pidf, "%d", &mode) != 1) + if (strcmp(gtm_app, "gtm_proxy") != 0) { - write_stderr(_("%s: invalid data in PID file \"%s\"\n"), - progname, pid_file); - exit(1); + if (fscanf(pidf, "%d", &mode) != 1) + { + write_stderr(_("%s: invalid data in PID file \"%s\"\n"), + progname, pid_file); + exit(1); + } } fclose(pidf); @@ -811,6 +814,8 @@ do_status(void) if (optlines != NULL) for (; *optlines != NULL; optlines++) fputs(*optlines, stdout); + if (strcmp(gtm_app, "gtm_proxy") != 0) + printf("%d %s\n", mode, mode == 1 ? "master" : "slave"); return; } } |