Commit 1bac5f55 authored by Peter Eisentraut's avatar Peter Eisentraut

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.
parent d80e73f2
...@@ -412,6 +412,13 @@ PostgreSQL documentation ...@@ -412,6 +412,13 @@ PostgreSQL documentation
<command>pg_ctl</command> returns an exit code based on the <command>pg_ctl</command> returns an exit code based on the
success of the startup or shutdown. success of the startup or shutdown.
</para> </para>
<para>
If the operation does not complete within the timeout (see
option <option>-t</option>), then <command>pg_ctl</command> exits with
a nonzero exit status. But note that the operation might continue in
the background and eventually succeed.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -840,7 +840,9 @@ do_start(void) ...@@ -840,7 +840,9 @@ do_start(void)
break; break;
case POSTMASTER_STILL_STARTING: case POSTMASTER_STILL_STARTING:
print_msg(_(" stopped waiting\n")); 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; break;
case POSTMASTER_FAILED: case POSTMASTER_FAILED:
print_msg(_(" stopped waiting\n")); print_msg(_(" stopped waiting\n"));
...@@ -1166,7 +1168,9 @@ do_promote(void) ...@@ -1166,7 +1168,9 @@ do_promote(void)
else else
{ {
print_msg(_(" stopped waiting\n")); 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 else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment