kafka服务器批量copy文件脚本
#!/bin/bash
if [[ $# -lt 1 ]] ; then echo no params ; exit ; fi
params=$@
for (( i=1 ; i <= 3 ; i = $i + 1 )) ; do
tput setaf 1
echo ===============bi-kafka-$i $params===============
tput setaf 9
ssh bi-kafka-$i "source /etc/profile; $params"
done
#!/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 = 1 ; i <= 3 ; i = $i + 1 )) ; do
tput setaf 1
echo =================bi-kafka-$i==============
tput setaf 9
rsync -lr $filename ${user}@bi-kafka-$i:$fullpath
done ;
#!/bin/bash
if [[ $# -lt 1 ]] ; then echo no params ; exit ; fi
params=$@
for (( i=101 ; i <= 103 ; i = $i + 1 )) ; do
tput setaf 1
echo ===============oldboy-node$i $params===============
tput setaf 9
ssh oldboy-node$i "source /etc/profile; $params"
done
if [[ $# -lt 1 ]] ; then echo no params ; exit ; fi
params=$@
for (( i=101 ; i <= 103 ; i = $i + 1 )) ; do
tput setaf 1
echo ===============oldboy-node$i $params===============
tput setaf 9
ssh oldboy-node$i "source /etc/profile; $params"
done
有些人,自甘堕落;有些人,即便身处深渊,也依旧笑容灿烂。