postgre init script is not LSB compliant (for heartbeat, i.e. linux-ha)

Bug #248939 reported by Florian Hackenberger on 2008-07-16
Affects Status Importance Assigned to Milestone
postgresql-8.3 (Ubuntu)
postgresql-common (Ubuntu)

Bug Description

Binary package hint: postgresql-8.3

Description: Ubuntu 8.04
Release: 8.04
Package: postgresql-8.3
Version: 8.3.1-1

In order to use postgresql in a heartbeat setup, I need the init script to report the status of the service according to the LSB standard [1]. The script /usr/share/postgresql-common/init.d-functions (which implements the actual init script correctly reports an exit status of 3 if the service is stopped and 0 if it is running. But the wrapper /etc/init.d/postgresql-8.3 does not pass the status on. The fix is very simple indeed and should probably be applied to the other parameters (start, stop, restart) as well.

--- /etc/init.d/postgresql-8.3.orig 2008-07-16 08:52:47.000000000 +0000
+++ /etc/init.d/postgresql-8.3 2008-07-16 08:42:18.000000000 +0000
@@ -35,6 +35,7 @@
         status $VERSION
+ exit $?
        autovac_start $VERSION


Onno Benschop (onno-itmaze) wrote :

I'm not sure that just returning the exit value will give you what you expect because in other patches we have identified that more and more init.d scripts are going to be running under a "set -e" environment where a non-zero return value terminates the script, so in your suggested patch, status $VERSION will terminate if the return value is non-zero, negating the purpose of exiting with a return value.

See for further discussion.

Mathias Andre (dies) wrote :

Patch attached.


Martin Pitt (pitti) wrote :

I don't understand what's wrong with the current init script. The "status" action already behaves LSB like, exiting with 0 if everything is running, with 3 if a cluster is down, and with 4 if no clusters are existing. Since the script is set -e, the "exit $?" patch is a no-op and does not change anything.

What would status_of_proc change here? IMHO using pg_lsclusters and pg_ctl are slightly more accurate here.

In either case, this should be changed in /usr/share/postgresql-common/init.d-functions and thus in postgresql-common, reassigning.

Changed in postgresql-8.3:
status: New → Incomplete
Martin Pitt (pitti) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in postgresql-common:
status: Incomplete → Invalid
Martin Pitt (pitti) on 2009-06-09
Changed in postgresql-8.3 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers