diff options
author | Michael Paquier | 2012-07-04 04:59:10 +0000 |
---|---|---|
committer | Michael Paquier | 2012-07-04 04:59:10 +0000 |
commit | 7c113772a540cc2282ecca031cea953f53f0fe88 (patch) | |
tree | 60cf0a8451b2274abeced459d45658e037436006 | |
parent | 4b4722fa21e660511673b00956a35140db0f2c7f (diff) |
Activate gtm_ctl status
gtm_ctl can control the status of a GTM server like pg_ctl does
with PostgreSQL instances (in the case of XC Coordinator and
Datanode).
Noticed by Koichi Suzuki, formatting of status output to get something
consistent with pg_ctl and clean up by me.
-rw-r--r-- | src/gtm/gtm_ctl/gtm_ctl.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/gtm/gtm_ctl/gtm_ctl.c b/src/gtm/gtm_ctl/gtm_ctl.c index d12132d7b9..1ebad1b306 100644 --- a/src/gtm/gtm_ctl/gtm_ctl.c +++ b/src/gtm/gtm_ctl/gtm_ctl.c @@ -777,11 +777,6 @@ do_status(void) fclose(pidf); - printf("pid: %ld\n", pid); - printf("data: %s\n", datpath); - printf("active: %d\n", mode); - -#ifdef NOT_USED pid = get_pgpid(); if (pid == 0) /* no pid file */ @@ -803,27 +798,26 @@ do_status(void) exit(1); } } - - if (!gtm_is_alive((pid_t) pid)) + else { - write_stderr(_("%s: old server process (PID: %ld) seems to be gone\n"), - progname, pid); - exit(1); - } + if (gtm_is_alive((pid_t) pid)) + { + char **optlines; - /* - * status check stuffs. - */ - exitcode = check_gtm(); - if (exitcode != 0) - { - write_stderr(_("%s: could not get server status: exit code was %d\n"), - progname, exitcode); - exit(1); + printf(_("%s: server is running (PID: %ld)\n"), + progname, pid); + + optlines = readfile(gtmopts_file); + if (optlines != NULL) + for (; *optlines != NULL; optlines++) + fputs(*optlines, stdout); + return; + } } -#endif /* NOT_USED */ -} + write_stderr(_("%s: no server running\n"), progname); + exit(1); +} /* |