X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sysv%2Frebootmgr;fp=sysv%2Frebootmgr;h=8d60dd92804041bd1676c7e589afaf65b4f1d407;hb=3f3cf95f755f3ef1c31ad8e38153deb4ee214c66;hp=0000000000000000000000000000000000000000;hpb=bfa4b37aaa195007a09bc166e8c8563d5a3c2ef1;p=util-vserver.git diff --git a/sysv/rebootmgr b/sysv/rebootmgr new file mode 100755 index 0000000..8d60dd9 --- /dev/null +++ b/sysv/rebootmgr @@ -0,0 +1,68 @@ +#!/bin/sh +# chkconfig: - 98 02 +# 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 +# processname: rebootmgr +# config: /etc/vservers + +: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2 + exit 1 +} +. "$UTIL_VSERVER_VARS" + +PIDFILE=/var/run/rebootmgr.pid +# See how we were called. +case "$1" in + start) + echo "Starting the reboot manager" + cd $__CONFDIR + 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 + $_REBOOTMGR --pidfile $PIDFILE $VSERVERS & + touch /var/lock/subsys/rebootmgr + ;; + stop) + echo "Stopping the reboot manager" + kill `cat $PIDFILE` + rm -f /var/lock/subsys/rebootmgr + rm -f $PIDFILE + ;; + restart) + $0 stop + $0 start + ;; + reload) + echo Not implemented + ;; + status) + if [ -f $PIDFILE ] ; then + if kill -0 `cat $PIDFILE` + then + echo rebootmgr is running + else + echo rebootmgr is NOT running + fi + fi + ;; + *) + echo "Usage: rebootmgr {start|stop|restart|reload|status}" + exit 1 +esac + +exit 0 + + + + +