  <appendix id="ap-lsb">
    <title>Is This init Script LSB Compatible?</title>
    <para>The relevant part of LSB spec can be found at: 
      <ulink url="http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html</ulink>. 
      It includes a description of all the return codes listed here.
    </para>
    <para>Assuming some_service is configured correctly and currently not active, the following sequence will help you determine if it is LSB compatible:</para>
    <orderedlist>
      <listitem>
	<para>Start (stopped): </para>
	<para><command>/etc/init.d/some_service start ; echo "result: $?"</command></para>
	<orderedlist>
	  <listitem><para>Did the service start?</para></listitem>
	  <listitem><para>Did the command print result: 0 (in addition to the regular output)?</para></listitem>
	</orderedlist>
      </listitem>
      <listitem><para>Status (running): </para>
	<para><command>/etc/init.d/some_service status ; echo "result: $?" </command></para>
	<orderedlist>
	  <listitem><para>Did the script accept the command?</para></listitem>
	  <listitem><para>Did the script indicate the service was running?</para></listitem>
	  <listitem><para>Did the command print result: 0 (in addition to the regular output)?</para></listitem>
	</orderedlist>
      </listitem>
      <listitem><para>Start (running):</para>
	<para><command> /etc/init.d/some_service start ; echo "result: $?" </command></para>
	<orderedlist>
	  <listitem><para>Is the service still running?</para></listitem>
	  <listitem><para>Did the command print result: 0 (in addition to the regular output)?</para></listitem>
	</orderedlist>
      </listitem>
      <listitem><para>Stop (running): </para>
	<para><command>/etc/init.d/some_service stop ; echo "result: $?" </command></para>
	<orderedlist>
	  <listitem><para>Was the service stopped?</para></listitem>
	  <listitem><para>Did the command print result: 0 (in addition to the regular output)?</para></listitem>
	</orderedlist>
      </listitem>
      <listitem><para>Status (stopped):</para>
	<para><command>/etc/init.d/some_service status ; echo "result: $?" </command></para>
	<orderedlist>
	  <listitem><para>Did the script accept the command?</para></listitem>
	  <listitem><para>Did the script indicate the service was not running?</para></listitem>
	  <listitem><para>Did the command print result: 3 (in addition to the regular output)?</para></listitem>
	</orderedlist>
      </listitem>
      <listitem>
	<para>Stop (stopped): </para>
	<para><command>/etc/init.d/some_service stop ; echo "result: $?" </command></para>
	<orderedlist>
	  <listitem><para>Is the service still stopped?</para></listitem>
	  <listitem><para>Did the command print result: 0 (in addition to the regular output)?</para></listitem>
	</orderedlist>
      </listitem>
      <listitem>
	<para>Status (failed): </para>
	<para>This step is not readily testable and relies on manual inspection of the script.</para>
	<para>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.</para>
	<para>This tells the cluster that before moving the resource to another node, it needs to stop it on the existing one first.</para>
      </listitem>
    </orderedlist>
    <para>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. </para>
    <para>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.</para>
  </appendix>
