HardenedBSD/contrib/dialog/samples/killall

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
382 B
Plaintext
Raw Normal View History

2011-01-13 03:21:23 +01:00
#! /bin/sh
# $Id: killall,v 1.4 2019/12/10 23:48:58 tom Exp $
2011-01-13 03:21:23 +01:00
# Linux has a program that does this correctly.
2012-10-21 20:18:09 +02:00
. ./setup-vars
for prog in "$@"
2011-01-13 03:21:23 +01:00
do
pid=`ps -a |fgrep "$prog" |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' `
2011-01-13 03:21:23 +01:00
if test -n "$pid" ; then
echo "killing pid=$pid, $prog"
kill "-$SIG_HUP" "$pid" || \
kill "-$SIG_TERM" "$pid" || \
kill "-$SIG_KILL" "$pid"
2011-01-13 03:21:23 +01:00
fi
done