InitScriptStatusActions

Differences between revisions 1 and 7 (spanning 6 versions)
Revision 1 as of 2008-07-10 00:52:48
Size: 2881
Editor: cpe-66-68-158-133
Comment: initial creation
Revision 7 as of 2008-07-16 14:09:19
Size: 2817
Editor: astatine
Comment: updated to show that Debian has accepted the base patch
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Overview == = Overview =
Line 6: Line 6:
=== status_of_proc() library function in lsb-base == == status_of_proc() library function in lsb-base ==
Line 8: Line 8:
DustinKirkland has been working with Debian to provide a status_of_proc() method in /lib/lsb/init-functions, which is provided by the lsb-base package. This function is present as of lsb-3.2-13: DustinKirkland has worked with Debian to provide a status_of_proc() method in /lib/lsb/init-functions, which is provided by the lsb-base package. This function is fully integrated in Debian's lsb-3.2-14:
Line 12: Line 12:

In the meantime, this functionality has been merged into Ubuntu's lsb-base package in lsb 3.2-12ubuntu3:
 * https://launchpad.net/ubuntu/intrepid/+source/lsb/3.2-12ubuntu3
This diff should be dropped as soon as Debian accepts the functionality and Ubuntu merges the package into Intrepid.
Line 29: Line 25:
 * OnnoBenschop/ubuntu-server/init.d-status  * https://wiki.ubuntu.com/OnnoBenschop/ubuntu-server/init.d-status
Line 48: Line 44:
  * add a dependency in debian/control for lsb >= 3.2-12ubuntu3   * add a dependency in debian/control for lsb-base >= 3.2-12ubuntu3
Line 51: Line 47:
   * don't if you're sending to Debian!  1. Test your patched init script
  * sh debian/FOO.init status
  * echo $?
  * sudo sh debian/FOO.init stop
  * sh debian/FOO.init status
  * echo $?
  * sudo sh debian/FOO.init start
  * sh debian/FOO.init status
  * echo $?

Overview

The LSB suggests that init scripts provide a status action:

status_of_proc() library function in lsb-base

DustinKirkland has worked with Debian to provide a status_of_proc() method in /lib/lsb/init-functions, which is provided by the lsb-base package. This function is fully integrated in Debian's lsb-3.2-14:

various init script callers

DustinKirkland has provided patches to the key service init scripts that are installable from the Ubuntu Server CD:

OnnoBenschop has provided a script to detect, and compiled a list of init scripts that are lacking status action here:

Countless other init scripts could/should be patched to provide this functionality.

Patch Checklist

When you encounter an init script that lacks a status action:

  1. Determine the source package
    • dpkg -S /etc/init.d/FOO
  2. Open a Bug in Launchpad against the package
  3. Grab the source
    • apt-get source FOO
    • sudo apt-get build-dep FOO
  4. Locate the init script in the source tree, often:
    • debian/*.init
    • debian/rc
  5. Patch the source to
    • have the init script call status_of_proc()
    • have the init script add "status" to the usage statement
    • add a dependency in debian/control for lsb-base >= 3.2-12ubuntu3

    • if you're sending to Ubuntu
      • add the changelog entry referencing your Launchpad bug
  6. Test your patched init script
    • sh debian/FOO.init status
    • echo $?
    • sudo sh debian/FOO.init stop
    • sh debian/FOO.init status
    • echo $?
    • sudo sh debian/FOO.init start
    • sh debian/FOO.init status
    • echo $?
  7. Build a source package
    • debuild -S
  8. Generate a patch
    • debdiff
  9. Compare your work to some of the other patches that did similar things.
  10. Add your patch to the Launchpad bug you filed

InitScriptStatusActions (last edited 2009-11-29 13:27:58 by 77-21-62-108-dynip)