opnsense-src/contrib/dialog/samples/killall

17 lines
364 B
Text
Raw Normal View History

2011-01-12 21:21:23 -05:00
#! /bin/sh
2012-10-21 14:18:09 -04:00
# $Id: killall,v 1.3 2012/06/29 09:39:19 tom Exp $
2011-01-12 21:21:23 -05:00
# Linux has a program that does this correctly.
2012-10-21 14:18:09 -04:00
. ./setup-vars
2011-01-12 21:21:23 -05:00
for prog in $*
do
pid=`ps -a |fgrep $prog |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' `
if test -n "$pid" ; then
echo killing pid=$pid, $prog
2012-10-21 14:18:09 -04:00
kill -$SIG_HUP $pid || \
kill -$SIG_TERM $pid || \
kill -$SIG_KILL $pid
2011-01-12 21:21:23 -05:00
fi
done