#!/bin/bash
#set -x
bin=dirname "$0"
bin=cd "$bin"; pwd
if [ $# -lt 3 ]
then
echo “Usage: ./deply.sh srcFile(or Dir) descFile(or Dir) MachineTag”
echo “Usage: ./deply.sh srcFile(or Dir) descFile(or Dir) MachineTag confFile”
exit
fi
src=$1
dest=$2
tag=$3
#me=hostname
if [ 'a’
4
′
a
′
=
=
′
a
a
′
]
t
h
e
n
c
o
n
f
F
i
l
e
=
"
4'a' == 'aa' ] then confFile="
4′a′==′aa′]thenconfFile="bin"/deploy.conf
else
confFile=$4
fi
if [ -f $confFile ]
then
if [ -f $src ]
then
for server in cat $confFile|grep -v '^#'|grep ','$tag','|awk -F',' '{print $1}'
do
scp $src
s
e
r
v
e
r
"
:
"
server":"
server":"{dest}
done
elif [ -d $src ]
then
for server in cat $confFile|grep -v '^#'|grep ','$tag','|awk -F',' '{print $1}'
do
scp -r $src
s
e
r
v
e
r
"
:
"
server":"
server":"{dest}
done
else
echo “Error: No source file exist”
fi
else
echo “Error: Please assign config file or run deploy.sh command with deploy.conf in same directory”
fi
######################################