3 # util-vserver: sets the path to vshelper and kills all guest processes
5 # chkconfig: 2345 10 99
6 # description: Sets the path to vshelper and kills all guest processes
8 # Source function library
9 . /etc/rc.d/init.d/functions
11 [ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
12 if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
13 echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
16 . "$UTIL_VSERVER_VARS"
20 show "Setting path to vshelper"
21 if [ -e /proc/sys/kernel/vshelper ]; then
22 echo "$_VSHELPER" >/proc/sys/kernel/vshelper
27 run_cmd "Loading default device map" $__PKGLIBDIR/bash-wrapper "handleDeviceMap --set 0 $__CONFDIR/.defaults/apps/vdevmap"
30 # Stop all running, but non-default guests"
33 run_cmd "Stopping all running guests" $_START_VSERVERS -j 1 --all --stop
35 xids=$(cd /proc/virtual ; echo [0-9]*)
36 if [ -n "$xids" ]; then
37 show "Sending all contexts the TERM signal"
39 $_VATTRIBUTE --xid $xid --set --flag ~persistent
40 $_VKILL --xid $xid -s 15
42 xids=$(cd /proc/virtual ; echo [0-9]*)
43 if [ -n "$xids" ]; then
49 if [ -n "$xids" ]; then
51 show "Sending all contexts the KILL signal"
53 $_VATTRIBUTE --xid $xid --set --flag ~persistent
54 $_VKILL --xid $xid -s 9
56 xids=$(cd /proc/virtual ; echo [0-9]*)
57 if [ -n "$xids" ]; then
66 # See how we were called.
80 [ $? -ne 0 ] && RETVAL=7
83 if [ -e /proc/sys/kernel/vshelper ]; then
84 read _vsh </proc/sys/kernel/vshelper
85 show "Path to vshelper: $_vsh, expected: $_VSHELPER"
86 if [ "$_vsh" = "$_VSHELPER" ]; then
98 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"