aboutsummaryrefslogtreecommitdiff
path: root/rc.single
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2009-07-30 15:00:06 -0300
committerAaron Griffin <aaronmgriffin@gmail.com>2009-07-30 11:18:44 -0700
commitabeacaed86e297923bd69de597a7e30dbf3cb990 (patch)
treea701c2028606f95560385101e588b906f0de86ff /rc.single
parent7f1bd75ee6aaffddf47e704c46fbab5396b7dd19 (diff)
downloadinitscripts-abeacaed86e297923bd69de597a7e30dbf3cb990.tar.xz
Shutdown non-rc.conf daemons first at rc.single
To match with commit 7f1bd75ee6aaffddf47e704c46fbab5396b7dd19 for rc.shutdown. Flip the order in which daemons are shutdown. First we scan for all daemons that are NOT in rc.conf and shut those down (order is based on ls, so it is dependent on LC_COLLATE). Afterwards, we shut down all daemons in rc.conf, in order. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'rc.single')
-rwxr-xr-xrc.single16
1 files changed, 9 insertions, 7 deletions
diff --git a/rc.single b/rc.single
index 6eaf063..af2ae16 100755
--- a/rc.single
+++ b/rc.single
@@ -7,7 +7,15 @@
. /etc/rc.d/functions
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
- # Shutdown daemons
+ # Find daemons NOT in the DAEMONS array. Shut these down first
+ if [ -d /var/run/daemons ]; then
+ for daemon in $(/bin/ls -1t /var/run/daemons); do
+ if ! in_array $daemon ${DAEMONS}; then
+ stop_daemon $daemon
+ fi
+ done
+ fi
+ # Shutdown daemons in reverse order
let i=${#DAEMONS[@]}-1
while [ $i -ge 0 ]; do
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
@@ -15,12 +23,6 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
fi
let i=i-1
done
- # find any leftover daemons and shut them down in reverse order
- if [ -d /var/run/daemons ]; then
- for daemon in $(/bin/ls -1t /var/run/daemons); do
- stop_daemon $daemon
- done
- fi
fi
if [ "$PREVLEVEL" != "N" ]; then