From: Peter Eisentraut Date: Mon, 1 May 2017 16:10:17 +0000 (-0400) Subject: pg_ctl: Make failure to complete operation a nonzero exit X-Git-Tag: REL_10_BETA2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1bac5f552a25aca3aa2ef1d404f7cdf7788c34d8;p=thirdparty%2Fpostgresql.git pg_ctl: Make failure to complete operation a nonzero exit If an operation being waited for does not complete within the timeout, then exit with a nonzero exit status. This was previously handled inconsistently. --- diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml index 71e52c4c355..12fa011c4e5 100644 --- a/doc/src/sgml/ref/pg_ctl-ref.sgml +++ b/doc/src/sgml/ref/pg_ctl-ref.sgml @@ -412,6 +412,13 @@ PostgreSQL documentation pg_ctl returns an exit code based on the success of the startup or shutdown. + + + If the operation does not complete within the timeout (see + option ), then pg_ctl exits with + a nonzero exit status. But note that the operation might continue in + the background and eventually succeed. + diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 0c65196bda4..4e02c4cea1a 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -840,7 +840,9 @@ do_start(void) break; case POSTMASTER_STILL_STARTING: print_msg(_(" stopped waiting\n")); - print_msg(_("server is still starting up\n")); + write_stderr(_("%s: server did not start in time\n"), + progname); + exit(1); break; case POSTMASTER_FAILED: print_msg(_(" stopped waiting\n")); @@ -1166,7 +1168,9 @@ do_promote(void) else { print_msg(_(" stopped waiting\n")); - print_msg(_("server is still promoting\n")); + write_stderr(_("%s: server did not promote in time\n"), + progname); + exit(1); } } else