From: Daniel Hokka Zakrisson Date: Mon, 10 Mar 2008 22:41:04 +0000 (+0000) Subject: bash doesn't execute traps until after the current job has finished executing, so... X-Git-Tag: release-0.30.215~6 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4bbc30e0100b45835690d8df5438f542c2b9bd2;p=util-vserver.git 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 --- 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 }