#!/bin/sh # chkconfig: - 98 10 # 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 VROOTDIR=/vservers USR_SBIN=/usr/sbin PIDFILE=/var/run/rebootmgr.pid # See how we were called. case "$1" in 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 $VROOTDIR/$serv ] ; then VSERVERS="$VSERVERS $serv" fi done $USR_SBIN/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|force-reload) $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