Re: [HACKERS] Change 'pg_ctl: no server running' Exit Status to 3

2011-10-13 Thread Bruce Momjian
Peter Eisentraut wrote:
 On m?n, 2011-05-23 at 20:50 -0400, Aaron W. Swenson wrote:
  According to Linux Standard Base Core Specification 3.1 [1], the exit
  status should be '3' when the server isn't running.
  
  I've attached a very simple patch that resolves this cosmetic issue,
  which applies to all branches.
 
 If we're going to make the exit status meaningful, it should probably be
 added to the documentation.

Patch attached and applied, with docs.  I also cleaned up some C
comments, which are not in the attached patch.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml
new file mode 100644
index 07836e7..7dc170e
*** a/doc/src/sgml/ref/pg_ctl-ref.sgml
--- b/doc/src/sgml/ref/pg_ctl-ref.sgml
*** PostgreSQL documentation
*** 205,211 
 optionstatus/option mode checks whether a server is running in
 the specified data directory. If it is, the acronymPID/acronym
 and the command line options that were used to invoke it are
!displayed.
/para
  
para
--- 205,212 
 optionstatus/option mode checks whether a server is running in
 the specified data directory. If it is, the acronymPID/acronym
 and the command line options that were used to invoke it are
!displayed.  If the server is not running, the process returns an
!exit status of 3.
/para
  
para
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
new file mode 100644
index c9007ed..8e9d2ce
*** a/src/bin/pg_ctl/pg_ctl.c
--- b/src/bin/pg_ctl/pg_ctl.c
*** do_status(void)
*** 1186,1192 
  		}
  	}
  	printf(_(%s: no server running\n), progname);
! 	exit(1);
  }
  
  
--- 1188,1198 
  		}
  	}
  	printf(_(%s: no server running\n), progname);
! 	/*
! 	 * 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);
  }
  
  

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Change 'pg_ctl: no server running' Exit Status to 3

2011-06-03 Thread Robert Haas
On Mon, May 23, 2011 at 8:50 PM, Aaron W. Swenson
aaron.w.swen...@gmail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 According to Linux Standard Base Core Specification 3.1 [1], the exit
 status should be '3' when the server isn't running.

 I've attached a very simple patch that resolves this cosmetic issue,
 which applies to all branches.

 My initial search regarding other platforms has turned up nil. It looks
 like they just check for a zero or non-zero exit status.

 As for the necessity of the patch: Gentoo Linux uses pg_ctl in all of
 its initscript actions for PostgreSQL. I'd imagine that Gentoo is not
 the only distribution that takes advantage of pg_ctl for its initscript
 actions.

I'd be disinclined to back-patch this as it might break things for
people.  But I see no harm in applying it to master, if nobody
objects...

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Change 'pg_ctl: no server running' Exit Status to 3

2011-06-03 Thread Peter Eisentraut
On mån, 2011-05-23 at 20:50 -0400, Aaron W. Swenson wrote:
 According to Linux Standard Base Core Specification 3.1 [1], the exit
 status should be '3' when the server isn't running.
 
 I've attached a very simple patch that resolves this cosmetic issue,
 which applies to all branches.

If we're going to make the exit status meaningful, it should probably be
added to the documentation.



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers