#!/bin/sh # # Stop/stop the cluster services on a real server. Leaves heartbeat and # the director services alone. Use "service heartbeat" to control those. # # by BVH 12 mar 2007 # VIP=vip1.mydomain.com PORT=http IPVSADM=/sbin/ipvsadm RS=`/bin/uname -n` STATUS="$IPVSADM -L" case "$1" in start) if [ `$STATUS | grep -c $VIP` -eq 1 ]; then if [ ! "X$2" = "X" ]; then RS=$2 fi echo "Adding $RS:$PORT to $VIP cluster..." $IPVSADM -e -t $VIP:$PORT -r $RS:$PORT -w 1 exec $STATUS else echo "$VIP cluster is not managed by this host" fi ;; stop) if [ `$STATUS | grep -c $VIP` -eq 1 ]; then if [ ! "X$2" = "X" ]; then RS=$2 fi echo "Removing $RS:$PORT from $VIP cluster..." echo " *** Please wait for all active connections to finish before stopping" echo " *** the service daemon. Check with \"service cluster status\"" echo $IPVSADM -e -t $VIP:$PORT -r $RS:$PORT -w 0 exec $STATUS else echo "$VIP cluster is not managed by this host" fi ;; status) exec $STATUS ;; *) echo "Usage: service cluster (start|stop|status) [real_server]" ;; esac