#!/bin/bash
if [ $# -lt 1 ];then
echo "The example usage introduction."
echo "eg : ssh_r_command.sh ./qery.sh mb ./all-tutk-sids 'ps -ef | grep IOTC_Server'"
exit
fi
filename=$2
region=$1
commandline=$3
echo "The all-tutk-sids is: "$filename
echo "The region is: "$region
while read line;
do
machine=$(echo $line | awk -F ":" '{print $1}')
if [ "$(echo $machine | grep "^${region}")" != "" ]
then
echo $machine
ssh $machine $commandline < /dev/null
fi
done < $2