rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [

想把hadoop102机器上的环境变量分发给hadoop103和hadoop104,xsync /etc/profile.d/my_env.sh

这里的xsync是自己的分发脚本

#!/bin/bash
#1. 判断参数个数
if [ $# -lt 1 ]
then
	echo Not Enough Arguement!
	exit;
fi

#2. 遍历集群所有机器
for host in hadoop102 hadoop103 hadoop104
do
	echo =========== $host =============
	#3. 遍历所有目录,挨个发送
	for file in $@
	do
		#4. 判断文件是否存在
		if [ -e $file ]
			then
				#5. 获取父目录
				pdir=$(cd -P $(dirname $file); pwd)
				#6. 获取当前文件的名称
				fname=$(basename $file)
				ssh $host "mkdir -p $pdir"
				rsync -av $pdir/$fname $host:$pdir
		else
			echo $file does not exists!
		fi
	done
done

但是报如下错误:

==================== hadoop102 ====================
sending incremental file list

sent 436 bytes  received 17 bytes  906.00 bytes/sec
total size is 16,961  speedup is 37.44
==================== hadoop103 ====================
sending incremental file list
rsync: failed to set times on "/etc/profile.d": Operation not permitted (1)
profile.d/
profile.d/my_env.sh
rsync: mkstemp "/etc/profile.d/.my_env.sh.gwiMC5" failed: Permission denied (13)

sent 970 bytes  received 210 bytes  786.67 bytes/sec
total size is 16,961  speedup is 14.37
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
==================== hadoop104 ====================
sending incremental file list
rsync: failed to set times on "/etc/profile.d": Operation not permitted (1)
profile.d/
profile.d/my_env.sh
rsync: mkstemp "/etc/profile.d/.my_env.sh.ezD90d" failed: Permission denied (13)

sent 970 bytes  received 210 bytes  786.67 bytes/sec
total size is 16,961  speedup is 14.37
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]

解决办法

sudo ./bin/xsync /etc/profile.d/my_env.sh

我的xsync脚本放在用户目录下的bin目录下(全局变量环境中),所以 . 这里表示当前在自己的用户目录下

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值