+#!/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
+
+
+
+
+