#! /bin/sh
set -e
PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/bin
NODETOOL=/usr/local/share/cassandra/bin/nodetool

if test $# -eq 0; then
	echo "$0 <any node in cluster> [keyspace]"
	exit 1;
fi	 
for i in `$NODETOOL -h $1 ring | cut -d ' ' -f 1 | grep -e '^[0-9]'`; do
	$NODETOOL -h $i repair $2
done
