diff options
author | Michael Imhof <tantive@gentoo.org> | 2004-03-29 12:11:05 +0000 |
---|---|---|
committer | Michael Imhof <tantive@gentoo.org> | 2004-03-29 12:11:05 +0000 |
commit | 9fe41da81b072e53f714e5726f4d9d12321ac010 (patch) | |
tree | c182934899f1a1feaa023db3b8640548974b1860 /sys-cluster | |
parent | dep for bricolage, bug 21549 (Manifest recommit) (diff) | |
download | gentoo-2-9fe41da81b072e53f714e5726f4d9d12321ac010.tar.gz gentoo-2-9fe41da81b072e53f714e5726f4d9d12321ac010.tar.bz2 gentoo-2-9fe41da81b072e53f714e5726f4d9d12321ac010.zip |
More fixes. Closes #45729.
Diffstat (limited to 'sys-cluster')
-rw-r--r-- | sys-cluster/util-vserver/files/rebootmgr.initd | 44 | ||||
-rw-r--r-- | sys-cluster/util-vserver/files/vservers.initd | 111 | ||||
-rw-r--r-- | sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild | 6 |
3 files changed, 160 insertions, 1 deletions
diff --git a/sys-cluster/util-vserver/files/rebootmgr.initd b/sys-cluster/util-vserver/files/rebootmgr.initd new file mode 100644 index 000000000000..5d2375b4e934 --- /dev/null +++ b/sys-cluster/util-vserver/files/rebootmgr.initd @@ -0,0 +1,44 @@ +#!/sbin/runscript +## description: The rebootmgr service is monitoring all virtual servers \ +## and restart them as need. Virtual servers are using \ +## the /sbin/vreboot command to talk with the reboot manager +## +## TODO: replace "echo" by "estart", add "eend", use "start-stop-daemon", ... + +DEFAULT_VSERVERDIR=/vservers +USR_SBIN=/usr/sbin +PIDFILE=/var/run/rebootmgr.pid + +start() { + echo "Starting the reboot manager" + cd /etc/vservers + VSERVERS= + for serv in *.conf + do + test -f "$serv" || continue + + serv=`basename $serv .conf` + if [ -d $DEFAULT_VSERVERDIR/$serv ] ; then + VSERVERS="$VSERVERS $serv" + fi + done + $USR_SBIN/rebootmgr --pidfile $PIDFILE $VSERVERS & +} + +stop() { + echo "Stopping the reboot manager" + kill `cat $PIDFILE` + rm -f $PIDFILE +} + +## TODO: do we want this? +my_status() { + if [ -f $PIDFILE ] ; then + if kill -0 `cat $PIDFILE` + then + echo rebootmgr is running + else + echo rebootmgr is NOT running + fi + fi +} diff --git a/sys-cluster/util-vserver/files/vservers.initd b/sys-cluster/util-vserver/files/vservers.initd new file mode 100644 index 000000000000..f7af525e7511 --- /dev/null +++ b/sys-cluster/util-vserver/files/vservers.initd @@ -0,0 +1,111 @@ +#!/sbin/runscript +## +## description: The vservers service is used to start and stop all +## the virtual servers. +## to configure see: +## - /etc/vservers/*.conf +## - /etc/vservers.conf + +USR_SBIN=/usr/sbin + +depend() { + need net rebootmgr +} + +## we need to call this _before_ starting any vserver! +proc_security() { + ## the following does not seem to work (maybe "old-style" only?): + ### from: http://vserver.strahlungsfrei.de/tiki-index.php?page=VServerGentooNew + ## enable (parts of) the proc filesystem + #vproc -e /proc/cmdline + #vproc -e /proc/loadavg + #vproc -e /proc/meminfo + ### invalid ioctl for /proc/mounts!! + ##vproc -e /proc/mounts + #vproc -e /proc/stat + #vproc -e /proc/uptime + ## (vproc -e /proc/version) + ## (useful and harmless: cpuinfo, slabinfo, interrupts) + #vproc -e /proc/cpuinfo + #vproc -e /proc/slabinfo + #vproc -e /proc/interrupts + + ## anyway, we use the following for now: + /usr/sbin/setattr -R --~hide /proc/* +} + +# Print the vserver name in priority/alpha order +sortserver(){ + ( + cd /etc/vservers + for serv in *.conf + do + test -f "$serv" || continue + + PRIORITY=100 + . $serv + test "$ONBOOT" || continue + printf "%03d %s\n" $PRIORITY `basename $serv .conf` + done + ) | sort $* | (while read a b; do echo $b; done) +} + +startservers(){ + echo "Starting the virtual servers" + cd /etc/vservers + for name in `sortserver` + do + ONBOOT= + . $name.conf + if [ "$ONBOOT" = "yes" ] ; then + echo; echo + echo "*** starting vserver \"$name\" ($(date)) ***" + $USR_SBIN/vserver $name start + else + echo "*** vserver \"$name\" not configured for on boot start ***" + fi + done +} + +BACKGROUND=off +if [ -f /etc/vservers.conf ] ; then + . /etc/vservers.conf +fi + + +# See how we were called. +start() { + proc_security + if [ "$BACKGROUND" = "yes" ] ; then + einfo "asynchronous start of vserver on tty8" + echo "vserver startup on $(date)" 2>&1 </dev/tty8 | tee /var/log/vservers.boot >/dev/tty8 + #startservers >/dev/tty8 </dev/tty8 2>/dev/tty8 & + startservers 2>&1 </dev/tty8 | tee /var/log/vservers.boot >/dev/tty8 & + else + estart "synchronous vserver-start" + startservers | tee /var/log/vservers.boot + eend $? + fi +} + +stop() { + echo "Stopping the virtual servers" + cd /etc/vservers + for name in `sortserver -r` + do + $USR_SBIN/vserver $name stop + done +} + +## TODO: finish our status()-function +my_status() { + cd /etc/vservers + for serv in *.conf + do + ONBOOT=no + name=`basename $serv .conf` + . $serv + echo -n ONBOOT=$ONBOOT " " + $USR_SBIN/vserver $name running + done +} diff --git a/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild b/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild index 90681429ae47..080696c21e85 100644 --- a/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild +++ b/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild,v 1.1 2004/03/25 20:03:29 tantive Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild,v 1.2 2004/03/29 12:11:05 tantive Exp $ MY_P="${P/_p/.}" DESCRIPTION="Vserver admin-tools." @@ -40,4 +40,8 @@ src_install() { ## remove the non-gentoo init-scripts: rm -r ${D}/etc/init.d + ## ... and install gentoo'ized ones: + insinto /etc/init.d/ + doins ${FILESDIR}/vservers.initd + doins ${FILESDIR}/rebootmgr.initd } |