###########
批量分发脚本
###########
#!/bin/bash #This script is written by jerry #This script is update on 2013-09-06 . /etc/init.d/functions if [ $# -ne 2 ] then echo "$0 file dir" exit fi for ip in `cat iplist` do rsync -avzP $1 -e 'ssh -t -p22' hadoop@$ip:~ > /dev/null 2>&1 ssh -t -p 22 hadoop@$ip "sudo rsync -avzP ~/$1 $2 && rm ~/$1" > /dev/null 2>&1 if [ $? -eq 0 ];then action "$ip" /bin/true else action "$ip" /bin/false fi done
#################
批量执行命令脚本
#################
#!/bin/bash params=$@ for IP in `cat iplist`;do { echo ========$IP $params========== ssh -t -p 22 hadoop@$IP "$params" }& done wait echo "all finished!"