bash doesn't execute traps until after the current job has finished executing, so...
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Mon, 10 Mar 2008 22:41:04 +0000 (22:41 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Mon, 10 Mar 2008 22:41:04 +0000 (22:41 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2701 94cd875c-1c1d-0410-91d2-eb244daf1a30

scripts/vserver-build.functions

index f615cad..4993c5c 100644 (file)
@@ -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
 }