From 401d22d5acee4b9bc0c74739f992fb8f62e4c561 Mon Sep 17 00:00:00 2001 From: roam Date: Tue, 17 Jul 2001 14:33:52 +0000 Subject: Add a script_name_sep rc.conf knob to specify the IFS character for separating the startup scripts' list into individual filenames. Run the shutdown scripts in reverse alphabetical order, so dependent services are stopped before the services they depend upon. Reviewed by: -arch, -audit MFC after: 3 weeks --- etc/defaults/rc.conf | 1 + etc/rc | 17 ++++++++++++----- etc/rc.shutdown | 17 ++++++++++++----- 3 files changed, 25 insertions(+), 10 deletions(-) (limited to 'etc') diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index fe4b914..04d6724 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -31,6 +31,7 @@ pccardd_flags="" # Additional flags for pccardd. pccard_conf="/etc/defaults/pccard.conf" # pccardd(8) config file removable_interfaces="" # Removable network interfaces for /etc/pccard_ether. local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs. +script_name_sep=" " # Change if your startup scripts' names contain spaces rc_conf_files="/etc/rc.conf /etc/rc.conf.local" fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails. background_fsck="YES" # Attempt to run fsck in the background where possible. diff --git a/etc/rc b/etc/rc index bc8c915..e77b260 100644 --- a/etc/rc +++ b/etc/rc @@ -793,17 +793,24 @@ case ${local_startup} in ;; *) echo -n 'Local package initialization:' + slist="" for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do - if [ -x "${script}" ]; then - (set -T - trap 'exit 1' 2 - ${script} start) - fi + 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) + fi + done + IFS="${script_save_sep}" echo '.' ;; esac diff --git a/etc/rc.shutdown b/etc/rc.shutdown index 0f77f47..1a565c7 100644 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -102,17 +102,24 @@ case ${local_startup} in [Nn][Oo] | '') ;; *) + slist="" for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do - if [ -x "${script}" ]; then - (set -T - trap 'exit 1' 2 - ${script} stop) - fi + slist="${script}${script_name_sep}${slist}" 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} stop) + fi + done + IFS="${script_save_sep}" echo '.' ;; esac -- cgit v1.1