# Is This init Script LSB Compatible?

The relevant part of LSB spec can be found at: http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html. It 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:

1. Start (stopped):

   `/etc/init.d/some_service start ; echo "result: $?"`

   1. Did the service start?

   2. Did the command print result: 0 (in addition to the regular output)?

2. Status (running):

   `/etc/init.d/some_service status ; echo "result: $?"`

   1. Did the script accept the command?

   2. Did the script indicate the service was running?

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

3. Start (running):

   `/etc/init.d/some_service start ; echo "result: $?"`

   1. Is the service still running?

   2. Did the command print result: 0 (in addition to the regular output)?

4. Stop (running):

   `/etc/init.d/some_service stop ; echo "result: $?"`

   1. Was the service stopped?

   2. Did the command print result: 0 (in addition to the regular output)?

5. Status (stopped):

   `/etc/init.d/some_service status ; echo "result: $?"`

   1. Did the script accept the command?

   2. Did the script indicate the service was not running?

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

6. Stop (stopped):

   `/etc/init.d/some_service stop ; echo "result: $?"`

   1. Is the service still stopped?

   2. 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 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.

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.