#! /bin/bash
iplist=(
10.130.2.40
10.130.2.41
10.130.2.42
10.130.2.44
10.130.2.45
10.130.2.49
10.130.2.50
10.130.2.51
10.130.2.53
10.130.2.54
10.130.2.55
10.130.2.56
10.130.2.57
10.130.2.58
10.130.2.59
10.130.2.60
)
user=dp
#将环境变量加入/etc/profile
function addetcprofile()
{
scp -r /opt/spark-1.6.1-bin-hadoop2.6/conf/spark-env.sh $host:/home/$user
ssh -t -p 22 $host "
sudo cp /home/$user/spark-env.sh /opt/spark-1.6.1-bin-hadoop2.6/conf/
"
scp -r /etc/profile $host:/home/$user/;
ssh -t -p 22 $host "
sudo cp -r /home/$user/profile /etc/
source /etc/profile
"}
for host in ${iplist[*]};
do
addetcprofile $host //传参数
done