where are /usr/local/etc/rc.d init scripts run from?
Kevin Brunelle
kruptos at mlinux.org
Sat Dec 23 16:52:16 PST 2006
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.
[/etc/rc:98-118]
# 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 ;;
esac
files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
_skip_early=1
for _rc_elem in ${files}; do
case "$_skip_early" in
1) case "$_rc_elem" in
*/${early_late_divider}) _skip_early=0 ;;
esac
continue
;;
esac
run_rc_script ${_rc_elem} ${_boot}
done
More information about the freebsd-questions
mailing list