#!/bin/sh
# Stop the cluster.

source config.sh

HOSTS=(`cat $CLUSTER_HOME/hosts`)
PORTS=(`cat $CLUSTER_HOME/ports`)

for ((i=0; i<${#HOSTS[*]}; ++i)); do
    host=${HOSTS[$i]}
    port=${PORTS[$i]}
    ssh $host "$QPIDD -qp $port" > /dev/null || {
	ret=1
	echo "ERROR: stopping broker at $host:$port"
    }
done

exit $ret
