exe order in /usr/local/etc/rc.d

Konrad Heuer kheuer2 at gwdg.de
Thu Oct 16 02:07:46 PDT 2003


On Thu, 16 Oct 2003, RJ45 wrote:


> I have never understood in which order are execurted the scripts which are
> in /usr/local/etc/rc.d
>
> most port applications like mysqld, cyrus-imapd, spamd etc. put their
> startup scripts into /usr/local/etc/rc.d but they are not ordered by a
> number attached before the script name (like the Unix SysV style)
>
> anyone has some hint about this ?
> How can I Set the startup order into /usr/local/etc/rc.d

The scripts are started from /etc/rc; the code fragement looks like:

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

Thus the scripts are executed in alphabetic order.

Regards

Konrad Heuer (kheuer2 at gwdg.de)  ____            ___  _______
GWDG                           / __/______ ___ / _ )/ __/ _ \
Am Fassberg                   / _// __/ -_) -_) _  |\ \/ // /
37077 Goettingen             /_/ /_/  \__/\__/____/___/____/
Germany


More information about the freebsd-questions mailing list