自学内容网 自学内容网

depsh

#!/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=" 4a==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

######################################


原文地址:https://blog.csdn.net/sunxunyong/article/details/142785071

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!