<option>status</option> mode checks whether a server is running in
the specified data directory. If it is, the <acronym>PID</acronym>
and the command line options that were used to invoke it are
- displayed.
+ displayed. If the server is not running, the process returns an
+ exit status of 3.
</para>
<para>
pgpid_t pid;
pid = get_pgpid();
- if (pid != 0) /* 0 means no pid file */
+ /* Is there a pid file? */
+ if (pid != 0)
{
- if (pid < 0) /* standalone backend */
+ /* standalone backend? */
+ if (pid < 0)
{
pid = -pid;
if (postmaster_is_alive((pid_t) pid))
}
}
else
- /* postmaster */
+ /* must be a postmaster */
{
if (postmaster_is_alive((pid_t) pid))
{
}
}
printf(_("%s: no server running\n"), progname);
- 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-generic/iniscrptact.html
+ */
+ exit(3);
}