summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/util-vserver-svn/files/init.d/vservers')
-rwxr-xr-xsys-cluster/util-vserver-svn/files/init.d/vservers107
1 files changed, 107 insertions, 0 deletions
diff --git a/sys-cluster/util-vserver-svn/files/init.d/vservers b/sys-cluster/util-vserver-svn/files/init.d/vservers
new file mode 100755
index 0000000..52c1cd7
--- /dev/null
+++ b/sys-cluster/util-vserver-svn/files/init.d/vservers
@@ -0,0 +1,107 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+opts="${opts} vstatus"
+
+checkconfig() {
+ : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+ if [[ ! -e ${UTIL_VSERVER_VARS} ]]; then
+ eerror "Cannot find util-vserver installation"
+ eerror "(the file '$UTIL_VSERVER_VARS' would be expected)"
+ exit 1
+ fi
+
+ source ${UTIL_VSERVER_VARS}
+ source ${_LIB_GENTOO_FUNCTIONS}
+
+ : ${MARKS:=default}
+ : ${NUMPARALLEL:=1}
+ : ${LOCKDIR:=/var/lock/vservers}
+}
+
+start() {
+ checkconfig
+
+ ebegin "Unhiding /proc entries"
+ ${_VPROCUNHIDE}
+ eend $?
+
+ if [[ -n ${STARTALL} ]]; then
+ ebegin "Starting all types of vservers"
+ ${_START_VSERVERS} -j ${NUMPARALLEL} --all --start
+ local rc=$?
+ [[ $rc -eq 0 ]] && touch ${LOCKDIR}/all
+ eend $rc
+ else
+ for MARK in ${MARKS}; do
+ ebegin "Starting vservers of type '${MARK}'"
+ ${_START_VSERVERS} -m ${MARK} -j ${NUMPARALLEL} --all --start
+ local rc=$?
+ [[ $rc -eq 0 ]] && touch ${LOCKDIR}/${MARK}
+ eend $rc
+ done
+ fi
+
+ for VSERVER in ${START_VSERVERS}; do
+ ebegin "Starting single vserver '${VSERVER}'"
+ ${_VSERVER} ${VSERVER} start
+ eend $?
+ done
+}
+
+stop() {
+ checkconfig
+
+ ebegin "Stopping all types of vservers"
+ ${_START_VSERVERS} -j ${NUMPARALLEL} --all --stop
+ eend $?
+
+ rm -f ${LOCKDIR}/*
+
+ einfo "Checking for vservers still running ..."
+
+ for i in $(vs_running_name 1); do
+ ebegin " Stopping single vserver: ${i}"
+ /usr/sbin/vserver ${i} stop &> /dev/null
+ eend $?
+ done
+}
+
+vstatus() {
+ checkconfig
+
+ local running="false"
+
+ einfo "${LOCKDIR} shows the following types of vservers running:"
+
+ for i in $( ls ${LOCKDIR} | sort ); do
+ einfo " ${i}"
+ running="true"
+ done
+
+ if [[ "${running}" != "true" ]]; then
+ einfo " none"
+ fi
+
+ running="false"
+
+ einfo
+ einfo "/proc/virtual/ says these are running:"
+
+ for i in $(vs_running_name 1); do
+ einfo " ${i}"
+ running="true"
+ done
+
+ if [[ "${running}" != "true" ]]; then
+ einfo " none"
+ fi
+
+
+ einfo
+ einfo "vserver-stat says these are running:"
+ /usr/sbin/vserver-stat
+}
+
+# vim:ts=4:filetype=gentoo-init-d