Skip to content

Commit 1bac5f5

Browse files
committed
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.
1 parent d80e73f commit 1bac5f5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,13 @@ PostgreSQL documentation
412412
<command>pg_ctl</command> returns an exit code based on the
413413
success of the startup or shutdown.
414414
</para>
415+
416+
<para>
417+
If the operation does not complete within the timeout (see
418+
option <option>-t</option>), then <command>pg_ctl</command> exits with
419+
a nonzero exit status. But note that the operation might continue in
420+
the background and eventually succeed.
421+
</para>
415422
</listitem>
416423
</varlistentry>
417424

src/bin/pg_ctl/pg_ctl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,9 @@ do_start(void)
840840
break;
841841
case POSTMASTER_STILL_STARTING:
842842
print_msg(_(" stopped waiting\n"));
843-
print_msg(_("server is still starting up\n"));
843+
write_stderr(_("%s: server did not start in time\n"),
844+
progname);
845+
exit(1);
844846
break;
845847
case POSTMASTER_FAILED:
846848
print_msg(_(" stopped waiting\n"));
@@ -1166,7 +1168,9 @@ do_promote(void)
11661168
else
11671169
{
11681170
print_msg(_(" stopped waiting\n"));
1169-
print_msg(_("server is still promoting\n"));
1171+
write_stderr(_("%s: server did not promote in time\n"),
1172+
progname);
1173+
exit(1);
11701174
}
11711175
}
11721176
else

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy