where are /usr/local/etc/rc.d init scripts run from?

Michael P. Soulier msoulier at digitaltorque.ca
Sat Dec 23 19:10:20 PST 2006


On 12/23/06, Kevin Brunelle <kruptos at mlinux.org> wrote:
> 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).

Ok, looking in localpkg, I see this.

pkg_start()
{
    # For each dir in $local_startup, search for init scripts matching *.sh
    #
    case ${local_startup} in
    [Nn][Oo] | '')
        ;;
    *)
        echo -n 'Local package initialization:'
        slist=""
        if [ -z "${script_name_sep}" ]; then
            script_name_sep=" "
        fi
        for dir in ${local_startup}; do
            if [ -d "${dir}" ]; then
                for script in ${dir}/*.sh; do
                    slist="${slist}${script_name_sep}${script}"
                done
            fi
        done
        script_save_sep="$IFS"
        IFS="${script_name_sep}"
        for script in ${slist}; do
            if [ -x "${script}" ]; then
                (set -T
                trap 'exit 1' 2
                ${script} start)
            elif [ -f "${script}" -o -L "${script}" ]; then
                echo -n " (skipping ${script##*/}, not executable)"
            fi
        done
        IFS="${script_save_sep}"
        echo '.'
        ;;
    esac
}

So rcorder is not used for the rc scripts in /usr/local/etc/rc.d? That
explains much, since I have a runsvstat.sh 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.

> 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.

Ok, thanks.

Mike
-- 
Michael P. Soulier <msoulier at digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein


More information about the freebsd-questions mailing list