3 # util-vserver sets the path to vshelper and kills all guest processes
5 # chkconfig: 2345 10 90
6 # description: Sets the path to vshelper and kills all guest processes
8 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
9 test -e "$UTIL_VSERVER_VARS" || {
10 echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
13 . "$UTIL_VSERVER_VARS"
16 . "$_LIB_VSERVER_INIT_FUNCTIONS"
18 . "$__PKGLIBDIR/vserver.functions"
23 local f="/proc/sys/kernel/vshelper"
25 echo "$_VSHELPER" > "$f"
32 function kill_contexts()
35 for xid in `ls -1 /proc/virtual 2>/dev/null`; do
36 test "$xid" = "info" -o "$xid" = "status" && continue
37 $_VATTRIBUTE --xid $xid --set --flag ~persistent
38 $_VKILL --xid $xid -s 15
40 $_VKILL --xid $xid -s 9
43 for xid in `ls -1 /proc/virtual 2>/dev/null`; do
44 test "$xid" = "info" -o "$xid" = "status" && continue
50 function create_dirs()
52 $_MKDIR -p "$__RUNDIR" && $_MKDIR -p "$__VSHELPERSTATEDIR" && $_MKDIR -p `$_READLINK "$__PKGSTATEREVDIR"`
55 function mount_cgroup()
57 _generateCgroupOptions
58 test -n "$CGROUP_MNT" || return 0
59 $_MKDIR -p "$CGROUP_MNT"
60 $_MOUNT -t cgroup -o "$CGROUP_SUBSYS" vserver "$CGROUP_MNT"
65 _beginResult $"Creating required directories"
68 _beginResult $"Setting path to vshelper"
72 _beginResult $"Loading default device map"
73 handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap"
76 _beginResult $"Mounting cgroup-hierarchy"
80 test "$retval" -ne 0 || touch "$lockfile"
86 # Stop all running, but non-default guests"
87 _beginResult $"Stopping all running guests"
88 $_START_VSERVERS -j 1 --all --stop
90 _beginResult $"Killing all running contexts"
105 start|stop|restart) $1;;
108 test -f $lockfile && restart || :
111 test -f $lockfile && {
112 echo $"Path to vshelper has been set"
115 echo $"Path to vshelper has not been set"
119 echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"