##################################
#INPUT: 
##################################

NODEFILE=""
FAILED=""
while [ $# -ge 1 ]; 
do
   case $1 in

     -l)   shift ; NODEFILE="$1";;
     -failed) shift ; FAILED="$1";;
   esac

   shift
done 

TARGETDIR="~/p2p_gaurav"
EXECTBLE="${TARGETDIR}/p2pmain"

#read site-list file
if [ -z $NODEFILE ];then
   exit 1;
else
exec 3<&0
exec 0<$NODEFILE

while read line
do
  if [ ! -z $FAILED ];then
   grep $line $FAILED
   retval=$?;
   if [ $retval == 0 ];then
	echo "ignore $line"
	continue;
   fi
  fi

   echo $line
   ssh  -i planet_rsa -fX columbia_salman@${line} "killall ${EXECTBLE} > /dev/null"  < /dev/null 
done
fi
