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

Bug #248939 reported by Florian Hackenberger
10
Affects Status Importance Assigned to Milestone
postgresql-8.3 (Ubuntu)
Invalid
Undecided
Unassigned
postgresql-common (Ubuntu)
Invalid
Undecided
Unassigned

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)
         status $VERSION
+ exit $?
        ;;
     autovac-start)
        autovac_start $VERSION

[1] http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Revision history for this message
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 https://wiki.ubuntu.com/InitScriptStatusActions for further discussion.

Revision history for this message
Mathias Andre (dies) wrote :

Patch attached.

Mathias

Revision history for this message
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
Revision history for this message
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)
Changed in postgresql-8.3 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.