pg_ctl.c-exit_status.patch

text/plain

Filename: pg_ctl.c-exit_status.patch
Type: text/plain
Part: 0
Message: Re: "pg_ctl promote" exit status

Patch

Format: unified
File+
src/bin/pg_ctl/pg_ctl.c 21 3
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index e412d71..6743849 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -900,7 +900,13 @@ do_stop(void)
 	{
 		write_stderr(_("%s: PID file \"%s\" does not exist\n"), progname, pid_file);
 		write_stderr(_("Is server running?\n"));
-		exit(1);
+                /*
+                 * The Linux Standard Base Core Specification 3.1 says this should return
+                 * '3'
+                 * http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-ge
+                 * neric/iniscrptact.html
+                 */
+                exit(3);
 	}
 	else if (pid < 0)			/* standalone backend, not postmaster */
 	{
@@ -1076,7 +1082,13 @@ do_reload(void)
 	{
 		write_stderr(_("%s: PID file \"%s\" does not exist\n"), progname, pid_file);
 		write_stderr(_("Is server running?\n"));
-		exit(1);
+                /*
+                 * The Linux Standard Base Core Specification 3.1 says this should return
+                 * '3'
+                 * http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-ge
+                 * neric/iniscrptact.html
+                 */
+                exit(3);
 	}
 	else if (pid < 0)			/* standalone backend, not postmaster */
 	{
@@ -1116,7 +1128,13 @@ do_promote(void)
 	{
 		write_stderr(_("%s: PID file \"%s\" does not exist\n"), progname, pid_file);
 		write_stderr(_("Is server running?\n"));
-		exit(1);
+                /*
+                 * The Linux Standard Base Core Specification 3.1 says this should return
+                 * '3'
+                 * http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-ge
+                 * neric/iniscrptact.html
+                 */
+                exit(3);
 	}
 	else if (pid < 0)			/* standalone backend, not postmaster */
 	{