[arch-projects] [initscripts] [PATCH 08/11] functions: Add stop_all_daemons() and related *_prestopdaemons hook

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Sat Jul 2 14:44:26 EDT 2011


This allows splash systems etc. to get a list of daemons to be stopped by simply overriding stop_daemon().
---
 functions |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/functions b/functions
index a8ef211..69f06eb 100644
--- a/functions
+++ b/functions
@@ -261,10 +261,10 @@ add_omit_pids() {
 	omit_pids+=( $@ )
 }

-
-kill_everything() {
-	# $1 = where we are being called from.
-	# This is used to determine which hooks to run.
+# Stop all daemons
+# This function should *never* ever perform any other actions beside calling stop_daemon()!
+# It might be used by a splash system etc. to count or get a list of daemons to be stopped.
+stop_all_daemons() {
 	# Find daemons NOT in the DAEMONS array. Shut these down first
 	local daemon
 	for daemon in /run/daemons/*; do
@@ -279,6 +279,15 @@ kill_everything() {
 		[[ ${DAEMONS[i]} = '!'* ]] && continue
 		ck_daemon ${DAEMONS[i]#@} || stop_daemon ${DAEMONS[i]#@}
 	done
+}
+
+kill_everything() {
+	# $1 = where we are being called from.
+	# This is used to determine which hooks to run.
+
+	run_hook "$1_prestopdaemons"
+
+	stop_all_daemons

 	run_hook "$1_prekillall"

--
1.7.1



More information about the arch-projects mailing list