]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/system/rc
2 ########################################################################
3 # Begin $rc_base/init.d/rc
5 # Description : Main Run Level Control Script
7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
13 ########################################################################
18 # This sets a few default terminal options.
21 # These 3 signals will not cause our script to exit
24 [ "${1}" != "" ] && runlevel
=${1}
26 if [ "${runlevel}" = "" ]; then
27 echo "Usage: ${0} <runlevel>" >&2
32 [ "${previous}" = "" ] && previous
=N
34 if [ ! -d ${rc_base}/rc
${runlevel}.d
]; then
35 boot_mesg
"${rc_base}/rc${runlevel}.d does not exist." ${WARNING}
40 # Attempt to stop all service started by previous runlevel,
41 # and killed in this runlevel
42 if [ "${previous}" != "N
" ]; then
43 for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null)
47 suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
48 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
49 sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
51 if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
52 if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
53 boot_mesg -n "WARNING
:\n\n${i} can
't be" ${WARNING}
54 boot_mesg -n " executed because it was not"
55 boot_mesg -n " not started in the previous"
56 boot_mesg -n " runlevel (${previous})."
57 boot_mesg "" ${NORMAL}
65 if [ "${error_value}" != "0" ]; then
71 #Start all functions in this runlevel
72 for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null)
74 suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
76 # Skip if initscript is disabled at bootprompt
77 grep "skipinit=$suffix" /proc/cmdline >/dev/null 2>&1 && continue
79 if [ "${previous}" != "N" ]; then
80 stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
81 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
83 [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
98 if [ "${error_value}" != "0" ]; then
103 # End $rc_base/init.d/rc