[appendix]

[[ap-lsb]]
== init-Script LSB Compliance ==

The relevant part of
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html[LSB spec]
includes a description of all the return codes listed here.
    
Assuming +some_service+ is configured correctly and currently not
active, the following sequence will help you determine if it is LSB
compatible:

. Start (stopped):
+
[source,C]
# /etc/init.d/some_service start ; echo "result: $?"
+
  .. Did the service start?
  .. Did the command print result: 0 (in addition to the regular output)?
+
. Status (running):
+
[source,C]
# /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)?
+
. Start (running):
+
[source,C]
# /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)?
+
. Stop (running):
+
[source,C]
# /etc/init.d/some_service stop ; echo "result: $?"
+
  .. Was the service stopped?
  .. Did the command print result: 0 (in addition to the regular output)?
+
. Status (stopped):
+
[source,C]
# /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)?
+
. Stop (stopped):
+
[source,C]
# /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)?
+
. Status (failed):
+
This step is not readily testable and relies on manual inspection of the script.
+
The script can use one of the error codes (other than 3) listed in the
LSB spec to indicate that it is active but failed. This tells the
cluster that before moving the resource to another node, it needs to
stop it on the existing one first.


If the answer to any of the above questions is no, then the script is
not LSB compliant. Your options are then to either fix the script or
write an OCF agent based on the existing script.
