首页 > 系统服务 > 详细

搭建Hadoop全分布式所用shell脚本之runRemoteCmd.sh

时间:2019-10-17 01:28:11      阅读:287      评论:0      收藏:0      [点我收藏+]
runRemoteCmd.sh脚本

#!/bin/bash
#set -x

if [ $# -lt 2 ]
then
echo "Usage: ./runRemoteCmd.sh Command MachineTag"
echo "Usage: ./runRemoteCmd.sh Command MachineTag confFile"
exit
fi

cmd=$1
tag=$2
if [ ‘a‘$3‘a‘ == ‘aa‘ ]
then
confFile=/home/hadoop/tools/deploy.conf
else
confFile=$3
fi
if [ -f $confFile ]
then
for server in cat $confFile|grep -v ‘^#‘|grep ‘,‘$tag‘,‘|awk -F‘,‘ ‘{print $1}‘
do
echo "$server"
ssh $server "source /etc/profile; $cmd"
done
else
echo "Error: Please assign config file or run deploy.sh command with deploy.conf in same directory"
fi

搭建Hadoop全分布式所用shell脚本之runRemoteCmd.sh

原文:https://blog.51cto.com/14572091/2442728

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!