<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7655.4">
<TITLE>/etc/init.d/rc may execute S##<name>  or K##<name> scripts twice if <name> starts with upper case characters</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Package: sysv-rc</FONT>

<BR><FONT SIZE=2 FACE="Arial">Version: 2.86.ds1-61</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">/etc/init.d/rc may execute S##<name>  or K##<name> scripts twice</FONT>

<BR><FONT SIZE=2 FACE="Arial">if <name> starts with upper case characters.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">/etc/init.d/rc execution loop works in principle as follows:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">generate alphabetically ordered list of all S* or K* files in the rc*.d directory</FONT>

<BR><FONT SIZE=2 FACE="Arial">set current level number to empty string</FONT>

<BR><FONT SIZE=2 FACE="Arial">for all files in list:</FONT>

<BR>        <FONT SIZE=2 FACE="Arial">remove leading S or K from file name</FONT>

<BR>        <FONT COLOR="#FF0000" SIZE=2 FACE="Arial">remove trailing <name> fom file name</FONT>

<BR>        <FONT SIZE=2 FACE="Arial">compare resulting ## number with current level number</FONT>

<BR>        <FONT SIZE=2 FACE="Arial">if numbers do not match</FONT>

<BR>                <FONT SIZE=2 FACE="Arial">set current level number to resulting ## number</FONT>

<BR>                <FONT SIZE=2 FACE="Arial">generate list of all files matching S##.* (or K##.* respectively)</FONT>

<BR>                <FONT SIZE=2 FACE="Arial">execute all script file found by the name pattern matching</FONT>

<BR>        <FONT SIZE=2 FACE="Arial">fi</FONT>

<BR><FONT SIZE=2 FACE="Arial">rof                     </FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">However, the script seems not to properly recognize and truncate <name> parts starting with upper case letters.</FONT>

<BR><FONT SIZE=2 FACE="Arial">So, if one defines a start script like<B> S99Tomcat</B></FONT>

<BR><FONT SIZE=2 FACE="Arial">the script does not only extract the number part</FONT><B> <FONT SIZE=2 FACE="Arial">99</FONT></B><FONT SIZE=2 FACE="Arial"> but also the upper case character(s) setting level number to</FONT><B> <FONT SIZE=2 FACE="Arial">99T</FONT></B>

<BR><FONT SIZE=2 FACE="Arial">Would s.o. name a script</FONT><B> <FONT SIZE=2 FACE="Arial">S99TOMCAT</FONT></B> <FONT SIZE=2 FACE="Arial">the resulting level number would be</FONT><B> <FONT SIZE=2 FACE="Arial">S99TOMCAT</FONT></B>

<BR>        

<BR><FONT SIZE=2 FACE="Arial">This alone does not produce an error, because the script does match the pattern S##.* (with ## being S99TOMCAT) and will be executed.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">But for the case that another script with same level number exists, S99TOMCAT will be executed twice.</FONT>

<BR><FONT SIZE=2 FACE="Arial">e.g: two scripts: S99TOMCAT and S99apache.</FONT>

<BR><FONT SIZE=2 FACE="Arial">for S99apache the resulting level number is 99.</FONT>

<BR><FONT SIZE=2 FACE="Arial">the loop then executes all scripts matching the pattern S99.*, which is s99apache and S99TOMCAT.</FONT>

<BR><FONT SIZE=2 FACE="Arial">for S99TOMCAT the resulting level number is 99TOMCAT, which does not match the curren level number 99.</FONT>

<BR><FONT SIZE=2 FACE="Arial">As a result the rc script handles 99TOMCAT like another level number and executes all scripts matching S99TOMCAT.* - and starts therefore S99TOMCAT for the second time.</FONT></P>

</BODY>
</HTML>