From: Harald Hoyer Date: Wed, 28 Sep 2011 14:02:59 +0000 (+0200) Subject: dracut-lib.sh: add killproc() X-Git-Tag: 014~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=745af91663a8e2718f87bf6e765c755cf10da98a;p=thirdparty%2Fdracut.git dracut-lib.sh: add killproc() --- diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 4dbddb194..cd10f1224 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 +}