On Sun, Jan 11, 2015 at 01:34:27PM +0100, Antoine Jacoutot wrote: > On Sun, Jan 11, 2015 at 12:57:42PM +0100, Simon Bertrang wrote: > > Hi, > > > > According to rc.subr(8) rc_check should return exit code 0 or 1 but > > Not really no. The "check" action should return 0|1. >
Ah right, different layer - same underlying thing though: postgresql.rc defines rc_check() which calls pg_ctl which does NOT return 0|1 but instead 3|?. > > for a running postgresql instance pg_ctl(1) returns 3. In the manpage > > under status it says: If the server is not running, the process returns > > an exit status of 3. > > > > Below a patch to fix that - can someone please take care of it? > > Does this fix an actual issue? > Yes, scripts or in my case automation tools that expect the status to match what is defined in rc.subr(8). Ansible fails to restart postgresql because of this to name a specific issue with it. Cheers, Simon > > Index: pkg/postgresql.rc > > =================================================================== > > RCS file: /cvs/ports/databases/postgresql/pkg/postgresql.rc,v > > retrieving revision 1.11 > > diff -u -r1.11 postgresql.rc > > --- pkg/postgresql.rc 23 Sep 2014 08:41:10 -0000 1.11 > > +++ pkg/postgresql.rc 11 Jan 2015 11:47:31 -0000 > > @@ -14,6 +14,11 @@ > > > > rc_check() { > > ${rcexec} "${daemon} -D ${datadir} status" > > + if [ $? -eq 3 ]; then > > + return 1 > > + else > > + return 0 > > + fi > > } > > > > rc_reload() { > > > > -- > Antoine >