1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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
|