Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12ff9fa

Browse files
committed
Have pg_ctl return an exit status of 3 if the server is not running, to
match the Linux Standard Base Core Specification 3.1.Aaron W. Swenson
1 parentde1bf53 commit12ff9fa

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ PostgreSQL documentation
205205
<option>status</option> mode checks whether a server is running in
206206
the specified data directory. If it is, the <acronym>PID</acronym>
207207
and the command line options that were used to invoke it are
208-
displayed.
208+
displayed. If the server is not running, the process returns an
209+
exit status of 3.
209210
</para>
210211

211212
<para>

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,11 @@ do_status(void)
11551155
pgpid_tpid;
11561156

11571157
pid=get_pgpid();
1158-
if (pid!=0)/* 0 means no pid file */
1158+
/* Is there a pid file? */
1159+
if (pid!=0)
11591160
{
1160-
if (pid<0)/* standalone backend */
1161+
/* standalone backend? */
1162+
if (pid<0)
11611163
{
11621164
pid=-pid;
11631165
if (postmaster_is_alive((pid_t)pid))
@@ -1168,7 +1170,7 @@ do_status(void)
11681170
}
11691171
}
11701172
else
1171-
/* postmaster */
1173+
/* must be a postmaster */
11721174
{
11731175
if (postmaster_is_alive((pid_t)pid))
11741176
{
@@ -1186,7 +1188,11 @@ do_status(void)
11861188
}
11871189
}
11881190
printf(_("%s: no server running\n"),progname);
1189-
exit(1);
1191+
/*
1192+
* The Linux Standard Base Core Specification 3.1 says this should return '3'
1193+
* http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
1194+
*/
1195+
exit(3);
11901196
}
11911197

11921198

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp