#!/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 USR_SBIN=/usr/sbin USR_LIB_VSERVER=/usr/lib/vserver PIDFILE=/var/run/rebootmgr.pid # See how we were called. case "$1" in start) echo -n "Starting the reboot manager: " if [ ! -e "$PIDFILE" ] ; then cd /etc/vservers VSERVERS= for serv in *.conf ; do serv=`basename $serv .conf` eval `$USR_LIB_VSERVER/printconf.sh --quote $serv` if [ -d $VSERVERDIR ] ; then VSERVERS="$VSERVERS $serv" fi done $USR_SBIN/rebootmgr --pidfile $PIDFILE $VSERVERS & touch /var/lock/subsys/rebootmgr echo "rebootmgr." else echo "already started." fi ;; stop) echo -n "Stopping the reboot manager: " if [ -s "$PIDFILE" ] ; then kill `cat $PIDFILE` rm -f /var/lock/subsys/rebootmgr rm -f $PIDFILE echo "rebootmgr." else echo "already stopped." fi ;; restart) $0 stop $0 start ;; reload) echo Not implemented ;; force-reload) $0 restart ;; 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|force-reload|status}" exit 1 esac exit 0