spawn(), killContext(): added
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Sun, 10 Apr 2005 00:54:33 +0000 (00:54 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Sun, 10 Apr 2005 00:54:33 +0000 (00:54 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2010 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/scripts/functions

index e9123f8..1aafeae 100644 (file)
@@ -111,6 +111,14 @@ function execute
     exit 0
 }
 
+
+## Usage: spawn <message>
+function spawn
+{
+    test -z "${DEBUG_EXEC:-}"       || echo  "$@"
+    test "${DEBUG_EXEC:-}" = noexec || "$@"
+}
+
 ## Usage: isNumber <arg>
 function isNumber
 {
@@ -566,6 +574,13 @@ function setDefaultTTY
     exec  &>$ttyname
 }
 
+## Usage: killContext <XID> [<SIG>]
+function killContext
+{
+    $_VKILL -s "${2:-9}" --xid "$1" 1 &>/dev/null || :
+    $_VKILL -s "${2:-9}" --xid "$1"   &>/dev/null || :
+}
+
 ## Usage: pkgmgmt.guessStyle <vserver> <resultvar>
 function pkgmgmt.guessStyle()
 {
@@ -842,7 +857,7 @@ function vshelper.doDestroy
     $_RM -f "$__VSHELPERSTATEDIR/$2"
 }
 
-## Usage: vshelper.initSync <vserver> <pipe-varname>
+## Usage: vshelper.initSync <vserver> <pipe-varname> [<method>]
 function vshelper.initSync
 {
     local _vis_tmpdir
@@ -853,7 +868,7 @@ function vshelper.initSync
 
     local _vis_fifo="$_vis_tmpdir"/pipe
     $_MKFIFO -m700 "$_vis_fifo"
-    vshelper.doInit "$1" sync "$_vis_fifo"
+    vshelper.doInit "$1" "${method:-sync}" "$_vis_fifo"
     eval $2=\$_vis_fifo
 }