From 745af91663a8e2718f87bf6e765c755cf10da98a Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 28 Sep 2011 16:02:59 +0200 Subject: [PATCH] dracut-lib.sh: add killproc() --- modules.d/99base/dracut-lib.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 4dbddb19..cd10f122 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -587,3 +587,16 @@ wait_for_dev() printf 'warn "\"%s\" does not exist"\n' $1 } >> "$hookdir/emergency/80-${_name}.sh" } + +killproc() { + local exe="$(command -v $1)" + local sig=$2 + local i + [ -x "$exe" ] || return 1 + for i in /proc/[0-9]*; do + [ "$i" = "/proc/1" ] && continue + if [ -e "$i"/exe ] && [ "$i/exe" -ef "$exe" ] ; then + kill $sig ${i##*/} + fi + done +}