Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Dec 2006 22:41:08 -0500
From:      Kevin Brunelle <>
Cc:        "Michael P. Soulier" <>
Subject:   Re: where are /usr/local/etc/rc.d init scripts run from?
Message-ID:  <>
In-Reply-To: <>
References:  <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
> So rcorder is not used for the rc scripts in /usr/local/etc/rc.d? That
> explains much, since I have a script needed to start
> runit, and a script to start one of its services starts with an 'm'
> and is executing first, which I don't want.
> Why is rcorder not used on these files as well? It's such a good system.

I was unintentionally confusing in my answer.  Sorry about that.  If your 
startup script is in the old style, it will be handled by /etc/rc.d/localpkg 
when that is called during the boot process.  That is ONLY if it's the old 

If it is part of the new style, it will be sorted *correctly* by rcorder with 
the other scripts in /etc/rc.d/.  I have to highlight correctly because for 
your script to actually be handled correctly it must appear in the order 
after the $early_late_divider (which is probably mountcritical but could be 
NETWORKING if you're running a jail or something else if it's redefined by 
your environment).   Typically, as long as your script appears after 
mountcritical, it will be handled correctly.

If you read /etc/rc carefully, you will see that rcorder is run twice.  The 
first time with just the scripts in /etc/rc.d/  and then it starts processing 
those.  This is the bit of code you included.  But, if you look, it breaks 
that look at the $early_late_divider and then goes down to the block I 
pointed out (starting on line 98 in my system).  In this case it finds all 
the "new style" scripts in the ${local_startup} directories and then uses 
rcorder to resort all the scripts in /etc/rc.d/ with the new style scripts 
from those directories.

Then code then loops again (this time ignoring scripts) until it hits the 
$early_late_divider and then runs all the scripts after that.  If your script 
appears earlier than that, it will be sorted into the section of scripts 
which won't be run.  In practice, this should not be a problem.

If your script is not being run correctly... you need to 
investigate /etc/rc.subr and try and understand why it is not seeing it as 
a "new style" script or if some other mistake is being made.  
find_local_scripts_new is the function that does this (line 1392 on my 
system) and is where I would look.

I hope this is a little more clear.


Want to link to this message? Use this URL: <>