# If so, first collect all the K* scripts in the new run level.
if [ ${previous} != N ]; then
for kill_script in $(ls /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null); do
- if [ -f ${kill_script} ]; then
- # "suffix" will contain the script name without the leading Kxx.
- suffix="${kill_script##*/K[0-9][0-9]}"
-
- # If there is a S script in the previous runlevel corresponding
- # to this K script, determine what it's full path is.
- previous_start="/etc/rc.d/rc${previous}.d/S[0-9][0-9]${suffix}"
-
- # If no start script was found in the previous run level it could
- # be that something was started in rcsysinit.d (sysinit level) so we'll
- # determine the path for that possibility as well.
- sysinit_start="/etc/rc.d/rcsysinit.d/S[0-9][0-9]${suffix}"
-
- # Stop the service if there is a start script in the previous run
- # level or in the sysinit level. Otherwise, don't execute this K
- # script because the service is not active.
- if [ -f ${previous_start} -o -f ${sysinit_start} ]; then
- startup ${kill_script} stop
- retval=${?}
- if [ ${retval} -ne ${EXIT_CODE_SUCCESS} -a ${retval} -ne ${EXIT_CODE_WARNING} ]; then
- print_error_msg ${kill_script} ${retval}
- fi
- fi
+ check_script_status ${kill_script}
+ if [ ${?} != ${EXIT_CODE_SUCCESS} ]; then
+ continue
+ fi
+
+ # "suffix" will contain the script name without the leading Kxx.
+ suffix="${kill_script##*/K[0-9][0-9]}"
+
+ # If there is a S script in the previous runlevel corresponding
+ # to this K script, determine what it's full path is.
+ previous_start="/etc/rc.d/rc${previous}.d/S[0-9][0-9]${suffix}"
+
+ # If no start script was found in the previous run level it could
+ # be that something was started in rcsysinit.d (sysinit level) so we'll
+ # determine the path for that possibility as well.
+ sysinit_start="/etc/rc.d/rcsysinit.d/S[0-9][0-9]${suffix}"
+
+ # Stop the service if there is a start script in the previous run
+ # level or in the sysinit level. Otherwise, don't execute this K
+ # script because the service is not active.
+ if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then
+ if [ ! -f ${previous_start} -a ! -f ${sysinit_start} ]; then
+ echo "Warning: script ${kill_script} cannot be stopped because it was not started"
+ echo "in the previous runlevel"
+ continue
+ fi
+ fi
+
+ startup ${kill_script} stop
+ retval=${?}
+ if [ ${retval} -ne ${EXIT_CODE_SUCCESS} -a ${retval} -ne ${EXIT_CODE_WARNING} ]; then
+ print_error_msg ${kill_script} ${retval}
fi
done
fi
# Now run the START scripts for this runlevel.
for start_script in $(ls /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null); do
- # "suffix" will contain the script name without the leading Sxx.
- suffix=${start_script#/etc/rc.d/rc${runlevel}.d/S[0-9][0-9]}
+ if [ "${previous}" != "N" ]; then
+ # "suffix" will contain the script name without the leading Sxx.
+ suffix=${start_script#/etc/rc.d/rc${runlevel}.d/S[0-9][0-9]}
- # If there is a K script in the current runlevel corresponding
- # to this S script, determine what it's full path is.
- current_stop=/etc/rc.d/rc${runlevel}.d/K[0-9][0-9]${suffix}
+ # If there is a K script in the current runlevel corresponding
+ # to this S script, determine what it's full path is.
+ current_stop=/etc/rc.d/rc${runlevel}.d/K[0-9][0-9]${suffix}
- if [ ${previous} != "N" ]; then
# If there is a S script in the previous runlevel corresponding
# to this S script, determine what it's full path is.
previous_start=/etc/rc.d/rc${previous}.d/S[0-9][0-9]${suffix}
- else
- previous_start=""
+
+ if [ -f ${previous_start} -a ! -f ${current_stop} ]; then
+ # If the service was started in the previous level and was not stopped
+ # in this runlevel, then we don't have to re-start it.
+ continue
+ fi
fi
- if [ -f "$previous_start" -a ! -f "$current_stop" ]; then
- # If the service was started in the previous level and was not stopped
- # in this runlevel, then we don't have to re-start it.
- continue
- else
- # If the service was not started in the previous level, or if we just
- # stopped it in this runlevel, then we need to start or restart it.
- check_script_status ${start_script}
- if [ ${?} == ${EXIT_CODE_SUCCESS} ]; then
- startup ${start_script} start
- retval=${?}
- if [ ${retval} -ne ${EXIT_CODE_SUCCESS} -a ${retval} -ne ${EXIT_CODE_WARNING} ]; then
- print_error_msg ${start_script} ${retval}
- fi
- fi
+ check_script_status ${start_script}
+ if [ ${?} != ${EXIT_CODE_SUCCESS} ]; then
+ continue
+ fi
+
+ # If the service was not started in the previous level, or if we just
+ # stopped it in this runlevel, then we need to start or restart it.
+
+ case ${runlevel} in
+ 0|6)
+ startup ${start_script} stop
+ ;;
+ *)
+ startup ${start_script} start
+ ;;
+ esac
+
+ retval=${?}
+ if [ ${retval} -ne ${EXIT_CODE_SUCCESS} -a ${retval} -ne ${EXIT_CODE_WARNING} ]; then
+ print_error_msg ${start_script} ${retval}
fi
done
bootscript_add_rcsysinit modules 20 00
bootscript_add_rcsysinit udev 25 00
bootscript_add_rcsysinit checkfs 30 00
-bootscript_add_rcsysinit mountfs 35 95
-bootscript_add_rcsysinit swap 40 94
+bootscript_add_rcsysinit mountfs 35 00
+bootscript_add_rcsysinit swap 40 00
bootscript_add_rcsysinit cleanfs 45 00
# rc0.d
-bootscript_add_manual 0 sendsignals 95 00
+bootscript_add_manual 0 sendsignals 60 00
+bootscript_add_manual 0 swap 65 00
+bootscript_add_manual 0 mountfs 70 00
bootscript_add_manual 0 halt 99 00
# rc6.d is almost identical to rc0.d
-bootscript_add_manual 6 sendsignals 95 00
+bootscript_add_manual 6 sendsignals 60 00
+bootscript_add_manual 6 swap 65 00
+bootscript_add_manual 6 mountfs 70 00
bootscript_add_manual 6 reboot 99 00
exit $?