added support for the --force option, which cause slam_tomb() to not wait 3 secs between kills

This commit is contained in:
Anathema 2011-08-18 11:01:17 +02:00
parent a5807344d5
commit 7584dc72e7

View File

@ -767,7 +767,6 @@ kill_tomb() {
# so we can get a for loop honestly # so we can get a for loop honestly
e=(${(s: :)e}) e=(${(s: :)e})
for p in $e; do for p in $e; do
echo "p $p"
func "killing PID $p..." func "killing PID $p..."
if [[ "$2" == "soft" ]]; then if [[ "$2" == "soft" ]]; then
kill -USR1 $p kill -USR1 $p
@ -797,7 +796,9 @@ slam_tomb() {
return 0 return 0
fi fi
sleep 3 # if we set the -f (force) option
# don't wait, just kill
option_is_set -f || sleep 3
kill_tomb "$pidk" "hard" kill_tomb "$pidk" "hard"
pidk=`lsof -t "$1"` pidk=`lsof -t "$1"`
if [[ -z "$pidk" ]]; then if [[ -z "$pidk" ]]; then
@ -806,7 +807,7 @@ slam_tomb() {
# if there are still some pids around # if there are still some pids around
# we have to kill 'em all # we have to kill 'em all
sleep 3 option_is_set -f || sleep 3
kill_tomb "$pidk" "must die" kill_tomb "$pidk" "must die"
pidk=`lsof -t "$1"` pidk=`lsof -t "$1"`
if [[ -z "$pidk" ]]; then if [[ -z "$pidk" ]]; then