标签:shell脚本
=======================xsync.sh======================================
#!/bin/bash
if [[ $# -lt 1 ]] ; then echo no params ; exit ; fi
p=$1
#echo p=$p
dir=`dirname $p`
#echo dir=$dir
filename=`basename $p`
#echo filename=$filename
cd $dir
fullpath=`pwd -p . `
#echo fullpath=$fullpath
user=`whoami`
for((i=202;i<=206;i=$i+1));do
echo ==========s$i============
rsync -lr $p ${user}@s$i:$fullpath
done ;
#!/bin/bash
if [[ $# -lt 1 ]] ; then echo no params ; exit ; fi
p=$1
dir=`dirname $p`
filename=`basename $p`
cd $dir
fullpath=`pwd -P . `
echo $fullpath
hosts=`cat /usr/local/bin/slaves`
for host in $hosts; do
echo ========== $host ============
rsync -lr $p ${user}@$host:$fullpath
done ;
标签:shell脚本
原文地址:http://13088442.blog.51cto.com/13078442/1943488