3 # vservers: starts and stops vservers
6 # description: Wrapper to start and stop vservers
7 # This script does not care for vservers not started by it
9 # Copyright 1999-2004 Gentoo Foundation
10 # Modified for PLD by Jan Rêkorajski <baggins@pld-linux.org>
11 # Distributed under the terms of the GNU General Public License v2
14 [ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
15 if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
16 echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
19 . "$UTIL_VSERVER_VARS"
21 [ -f /etc/sysconfig/vservers ] && . /etc/sysconfig/vservers
23 [ -n "$MARKS" ] || MARKS="default"
24 [ -n "$NUMPARALLEL" ] || NUMPARALLEL=1
25 [ -n "$LOCKDIR" ] || LOCKDIR="/var/lock/vservers"
41 if [ ! -f /var/lock/subsys/vprocunhide ]; then
42 echo "Run \"/etc/rc.d/init.d/vprocunhide start\" first"
46 if [ is_yes "$STARTALL" ]; then
47 if [ ! -f /var/lock/subsys/vservers-all ]; then
48 show "Starting all types of vservers"
50 $_START_VSERVERS -j $NUMPARALLEL --all --start
53 [ $rc -eq 0 ] && touch /var/lock/subsys/vservers-all
55 echo "All types of vservers are already startred"
58 for MARK in $MARKS; do
59 if [ -f /var/lock/subsys/vservers-$MARK ]; then
60 echo "Vservers of type '$MARK' are already startred"
63 show "Starting vservers of type '$MARK'"
65 $_START_VSERVERS -m $MARK -j $NUMPARALLEL --all --start
68 [ $rc -eq 0 ] && touch /var/lock/subsys/vservers-$MARK
72 for VSERVER in $START_VSERVERS; do
73 if [ -f /var/lock/subsys/vserver-$VSERVER ]; then
74 echo "Vserver '$VSERVER' is already startred"
77 show "Starting single vserver '$VSERVER'"
79 $_VSERVER $VSERVER start
82 [ $rc -eq 0 ] && touch /var/lock/subsys/vserver-$VSERVER
86 for VSERVER in $START_VSERVERS; do
87 if [ ! -f /var/lock/subsys/vserver-$VSERVER ]; then
88 echo "Vserver '$VSERVER' is not running"
91 show "Stopping single vserver '$VSERVER'"
93 $_VSERVER $VSERVER stop
96 rm -f /var/lock/subsys/vserver-$VSERVER
99 if [ is_yes "$STARTALL" ]; then
100 if [ -f /var/lock/subsys/vservers-all ]; then
101 show "Stopping all types of vservers"
103 $_START_VSERVERS -j $NUMPARALLEL --all --stop
106 rm -f /var/lock/subsys/vservers-all
108 echo "All types of vservers are not running"
111 for MARK in $MARKS; do
112 if [ ! -f /var/lock/subsys/vservers-$MARK ]; then
113 echo "Vservers of type '$MARK' are not running"
116 show "Stopping vservers of type '$MARK'"
118 $_START_VSERVERS -m $MARK -j $NUMPARALLEL --all --stop
121 rm -f /var/lock/subsys/vservers-$MARK
126 echo "The following types of vservers are running:"
128 for i in /var/lock/subsys/vservers-*; do
129 [ -f "$i" ] || continue
130 echo $i | awk '{gsub("/var/lock/subsys/vservers-",""); printf(" %s\n",$0); }'
134 if [[ "${running}" != "true" ]]; then
139 echo "/proc/virtual/ says these are running:"
141 for i in /proc/virtual/*; do
142 [ -d $i ] || continue
143 NAME=$( basename $( vuname -g --xid $( basename ${i} ) CONTEX ) )
148 echo "vserver-stat says these are running:"
149 /usr/sbin/vserver-stat
152 echo "Usage: $0 {start|stop|restart|status}"
159 # This must be last line !