|
Revision 2674, 1.5 kB
(checked in by dhozac, 10 months ago)
|
Add missing svn:keywords.
|
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
#!/sbin/runscript |
|---|
| 2 |
# Copyright 1999-2007 Gentoo Foundation |
|---|
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
|---|
| 4 |
|
|---|
| 5 |
set_helper() { |
|---|
| 6 |
local f="/proc/sys/kernel/vshelper" |
|---|
| 7 |
if [ -e "$f" ]; then |
|---|
| 8 |
echo "$_VSHELPER" > "$f" |
|---|
| 9 |
fi |
|---|
| 10 |
return 0 |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
kill_contexts() { |
|---|
| 14 |
local xid |
|---|
| 15 |
for xid in `ls -1 /proc/virtual`; do |
|---|
| 16 |
[ "$xid" = "info" -o "$xid" = "status" ] && continue |
|---|
| 17 |
$_VATTRIBUTE --xid $xid --set --flag ~persistent |
|---|
| 18 |
$_VKILL --xid $xid -s 15 |
|---|
| 19 |
sleep 3 |
|---|
| 20 |
$_VKILL --xid $xid -s 9 |
|---|
| 21 |
done |
|---|
| 22 |
local alive=0 |
|---|
| 23 |
for xid in `ls -1 /proc/virtual`; do |
|---|
| 24 |
[ "$xid" = "info" -o "$xid" = "status" ] && continue |
|---|
| 25 |
let alive+=1 |
|---|
| 26 |
done |
|---|
| 27 |
return $alive |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
start() { |
|---|
| 31 |
: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} |
|---|
| 32 |
if [ ! -e ${UTIL_VSERVER_VARS} ]; then |
|---|
| 33 |
eerror "Cannot find util-vserver installation" |
|---|
| 34 |
eerror "(the file '$UTIL_VSERVER_VARS' would be expected)" |
|---|
| 35 |
return 1 |
|---|
| 36 |
fi |
|---|
| 37 |
|
|---|
| 38 |
. ${UTIL_VSERVER_VARS} |
|---|
| 39 |
|
|---|
| 40 |
ebegin "Setting vshelper path to $_VSHELPER" |
|---|
| 41 |
set_helper |
|---|
| 42 |
eend $? |
|---|
| 43 |
|
|---|
| 44 |
ebegin "Loading default device map" |
|---|
| 45 |
$__PKGLIBDIR/bash-wrapper 'handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap"' |
|---|
| 46 |
eend $? |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
stop() { |
|---|
| 50 |
: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} |
|---|
| 51 |
if [ ! -e ${UTIL_VSERVER_VARS} ]; then |
|---|
| 52 |
eerror "Cannot find util-vserver installation" |
|---|
| 53 |
eerror "(the file '$UTIL_VSERVER_VARS' would be expected)" |
|---|
| 54 |
return 1 |
|---|
| 55 |
fi |
|---|
| 56 |
|
|---|
| 57 |
. ${UTIL_VSERVER_VARS} |
|---|
| 58 |
|
|---|
| 59 |
ebegin "Stopping all running guests" |
|---|
| 60 |
$_START_VSERVERS -j 1 --all --stop |
|---|
| 61 |
eend $? |
|---|
| 62 |
|
|---|
| 63 |
ebegin "Killing all running contexts" |
|---|
| 64 |
kill_contexts |
|---|
| 65 |
eend $? |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
# vim:ts=4:filetype=gentoo-init-d |
|---|