Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Dec 2006 18:52:55 -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
On Saturday 23 December 2006 18:15, Michael P. Soulier wrote:
> I was looking in /etc/rc, and it's obvious to see where the /etc/rc.d
> scripts are run from.
> skip="-s nostart"
> [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail"
> files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
> for _rc_elem in ${files}; do
>         run_rc_script ${_rc_elem} ${_boot}
> done
> So rcorder is run over /etc/rc.d/*.
> When is the same done for /usr/local/etc/rc.d/*?
> Thanks,
> Mike

They are called from /etc/rc.d/localpkg if they are the old style.

The directories searched are defined with local_startup (which defaults 
to: /usr/local/etc/rc.d /usr/X11R6/etc/rc.d).

The new style scripts are found in /etc/rc as well.  You may want to look at 
the find_local_scripts_new() function in /etc/rc.subr to see how some of this 
functions.  There is some trickery here because we have to do this in more 
than one step.  Since /usr/local/etc/rc.d/ may not be on a mounted filesystem 
until we run through some of the earlier scripts.

# Now that disks are mounted, for each dir in $local_startup
# search for init scripts that use the new rc.d semantics.
case ${local_startup} in
[Nn][Oo] | '') ;;
*)  find_local_scripts_new ;;

files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
for _rc_elem in ${files}; do
    case "$_skip_early" in
    1)  case "$_rc_elem" in
        */${early_late_divider})    _skip_early=0 ;;

    run_rc_script ${_rc_elem} ${_boot}

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