#!/bin/sh # chkconfig: 345 99 01 # description: The vservers service is used to start and stop all # the virtual servers. USR_SBIN=/usr/sbin VROOTDIR=/vservers # Print the vserver name in priority/alpha order sortserver(){ ( cd /etc/vservers for serv in *.conf ; do test -f "$serv" || continue PRIORITY=100 . $serv 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 if ! test -f "$name.conf" ; then echo No configuration for this vserver: /etc/vservers/$name.conf continue fi ONBOOT= BACKGROUND=no if [ -f /etc/vservers.conf ] ; then . /etc/vservers.conf fi . $name.conf if [ "$ONBOOT" = "yes" ] ; then mkdir -p $VROOTDIR/$name/var/log if [ "$BACKGROUND" = "yes" ] ; then nohup setsid $USR_SBIN/vserver $name start >$VROOTDIR/$name/var/log/boot.log 2>&1 &1