This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

Homepage

About Us

Contact Us

Legal Info

How To Contribute

Security Issues

This web page is no longer maintained. Information presented here exists only to avoid breaking historical links.
The Project stays maintained, and lives on: see the Linux-HA Reference Documentation.

1 February 2010 Hearbeat 3.0.2 released see the Release Notes

18 January 2009 Pacemaker 1.0.7 released see the Release Notes

16 November 2009 LINBIT new Heartbeat Steward see the Announcement

Last site update:
2010-03-17 04:38:27

Background

LSB Resource Agents are those found in /etc/init.d. Generally they are provided by the OS/distribution and in order to be used with version 2 of Heartbeat, must conform to the LSB Spec.

The LSB Spec (as it relates to init scripts) can be found at: http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Many distributions claim LSB compliance but ship with broken init scripts. The most common problems are:

  • Not implementing the status operation at all
  • Not observing the correct exit status codes for start/stop/status actions
  • Starting a started resource returns an error (this violates the LSB spec)
  • Stopping a stopped resource returns an error (this violates the LSB spec)

NOTE: Parameters and options can not be passed to LSB Resource Agents.

Init Script (LSB) Compatibility Checks

Assuming some_service is configured correctly and currently not active, the following sequence will help you determine if it is LSB compatible:

  1. Start (stopped)
    • /etc/init.d/some_service start ; echo "result: $?"

    • Did the service start?
    • Did the command print result: 0 (in addition to the regular output)?

  2. Status (running)
    • /etc/init.d/some_service status ; echo "result: $?"

    • Did the script accept the command?
    • Did the script indicate the service was running?
    • Did the command print result: 0 (in addition to the regular output)?

  3. Start (running)
    • /etc/init.d/some_service start ; echo "result: $?"

    • Is the service still running?
    • Did the command print result: 0 (in addition to the regular output)?

  4. Stop (running)
    • /etc/init.d/some_service stop ; echo "result: $?"

    • Was the service stopped?
    • Did the command print result: 0 (in addition to the regular output)?

  5. Status (stopped)
    • /etc/init.d/some_service status ; echo "result: $?"

    • Did the script accept the command?
    • Did the script indicate the service was not running?

    • Did the command print result: 3 (in addition to the regular output)?

  6. Stop (stopped)
    • /etc/init.d/some_service stop ; echo "result: $?"

    • Is the service still stopped?
    • Did the command print result: 0 (in addition to the regular output)?

  7. Status (failed)
    • This step is not readily testable and relies on manual inspection of the script.
      The script can optionally use one of the other codes listed in the LSB spec to indicate that it is active but failed. In such a case, this tells Heartbeat that before moving the resource to another node, it should stop it on the existing one first. Making use of these extra exit codes is encouraged.

If the answer to any of the above questions is no, then the init script is not LSB compliant.

If you are using version 2 of Heartbeat and have specified crm yes, then your options at this point are to:

  1. fix the init script
  2. write an OCFResourceAgent based on the existing init script

If you are using version 1 of Heartbeat or have not specified crm yes, then the script may still work as long as it follows the rules for HeartbeatResourceAgents.

See Also

ResourceAgent