hadoop batch transfer script command script xrsync.sh

1.xrsync.sh script

#!/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 <= 204 ; i = $i + 1 )) ; do
   echo ======= s$i =======
   rsync -lr $p ${user}@s$i:$fullpath
done ;

  You need to install rsync remote data synchronization tool

yum install rsync

  Where i represents the name of the server portion of the tail number, the name of the server s202, s203, s204, etc.

Xrsync.sh need to put up / down usr / local / bin, can be used in any directory use

Example: The hbase-2.2.0 synchronized to other machines / opt / directory

xrsync.sh hbase-2.2.0 /opt/

  

Guess you like

Origin www.cnblogs.com/qixing/p/11431607.html