From f4bbc30e0100b45835690d8df5438f542c2b9bd2 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Mon, 10 Mar 2008 22:41:04 +0000 Subject: [PATCH] bash doesn't execute traps until after the current job has finished executing, so run sleep in a loop. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2701 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- scripts/vserver-build.functions | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/vserver-build.functions b/scripts/vserver-build.functions index f615cad..4993c5c 100644 --- a/scripts/vserver-build.functions +++ b/scripts/vserver-build.functions @@ -269,7 +269,11 @@ function startSleepingGuest exec > /dev/null exec 2> /dev/null trap 'kill -s 9 -- -1; exit 0' INT - sleep $timeout + i=0 + while [ \$i -lt $timeout ]; do + sleep 1 + let ++i + done kill -s 15 -- -1 sleep 1 kill -s 9 -- -1" @@ -278,5 +282,5 @@ function startSleepingGuest function stopSleepingGuest { local guest="$1" - $_VKILL --xid "$guest" -s INT -- 0 + $_VKILL --xid "$guest" -s INT -- 1 } -- 1.8.1.5