#!/bin/bash
#set -x
bin=dirname "$0"
bin=cd "$bin"; pwd
echo $bin
if [ $# -lt 2 ]
then
echo “Usage: ./runRemoteCmd.sh Command MachineTag”
echo “Usage: ./runRemoteCmd.sh Command MachineTag confFile”
exit
fi
cmd=$1
tag=$2
if [ 'a’
3
′
a
′
=
=
′
a
a
′
]
t
h
e
n
c
o
n
f
F
i
l
e
=
"
3'a' == 'aa' ] then confFile="
3′a′==′aa′]thenconfFile="bin"/deploy.conf
else
confFile=$
fi
if [ -f $confFile ]
then
for server in cat $confFile|grep -v '^#'|grep ','$tag','|awk -F',' '{print $1}'
do
echo “$server********”
ssh $server “source ~/.bash_profile; $cmd”
done
else
echo “Error: Please assign config file or run deploy.sh command with deploy.conf in same directory”
fi
############################################
10.7.52,newcdh,
10.7.53,newcdh,