summaryrefslogtreecommitdiff
path: root/rc.shutdown
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-07 10:24:43 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-07-11 20:23:46 -0500
commit9390083d675e1fd5059ab35d9977bf84b7d87ba2 (patch)
treeec56dd94809b4f40f2f10f98c1116d0a8d399693 /rc.shutdown
parente74e3cf9d545885cc587ede9fd157c39d4d9a324 (diff)
Both rc.single and rc.shutdown use the same code to kill everything.
Simplify it, and move that shared code into functions. Parsing the output of ls is Bad, especially when globbing works just as well and does not get confused by odd characters in filenames. bash has arithemetic for loops. Use them instead of while loops for iterating over arrays.
Diffstat (limited to 'rc.shutdown')
-rwxr-xr-xrc.shutdown36
1 files changed, 2 insertions, 34 deletions
diff --git a/rc.shutdown b/rc.shutdown
index 4eb29cc..d540364 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -19,41 +19,9 @@ echo " "
if [ -x /bin/domainname ]; then
/bin/domainname ""
fi
+[[ -x /etc/rc.local.shutdown ]] && /etc/rc.local.shutdown
-if [ -x /etc/rc.local.shutdown ]; then
- /etc/rc.local.shutdown
-fi
-
-# 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
- ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
- fi
- let i=i-1
-done
-
-# Terminate all processes
-stat_busy "Sending SIGTERM To Processes"
-run_hook shutdown_prekillall
-/sbin/killall5 -15 &> /dev/null
-/bin/sleep 5
-stat_done
-
-stat_busy "Sending SIGKILL To Processes"
-/sbin/killall5 -9 &> /dev/null
-/bin/sleep 1
-stat_done
-
-run_hook shutdown_postkillall
+kill_everything shutdown
stat_busy "Saving Random Seed"
RANDOM_SEED=/var/lib/misc/random-seed