rsync实时同步报错rsync error: some files/attrs were not transferred (see previous errors) (code 23) at mai

inotify+rsync 实时同步报错

一、报错信息

能够正常同步,但是会出现下面的报错信息:

[root@192 opt]# ./inotify.sh
rsync: failed to set times on "/." (in wwwroot): Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.9]

rsync实时同步报错rsync error: some files/attrs were not transferred (see previous errors) (code 23) at mai

脚本文件如下:

[root@192 opt]# vim /opt/inotify.sh

#!/bin/bash
INOTIFY_CMD="inotifywait -mrq -e modify,create,attrib,move,delete /var/www/html/"
RSYNC_CMD="rsync -azH --delete --password-file=/etc/server.pass /var/www/html/ backuper@192.168.229.90::wwwroot/"
$INOTIFY_CMD | while read DIRECTORY EVENT FILE
##while判断是否接收到监控记录
do
    if [ $(pgrep rsync | wc -l) -le 0 ] ; then
        $RSYNC_CMD
    fi
done

二、解决方法

进入rsync服务器的配置文件,将uid和gid改为root即可;

vi /etc/rsyncd.conf 
uid = root
gid = root

rsync实时同步报错rsync error: some files/attrs were not transferred (see previous errors) (code 23) at mai

重启rsync服务  

kill $(cat /var/run/rsyncd.pid)
rsync --daemon

rsync实时同步报错rsync error: some files/attrs were not transferred (see previous errors) (code 23) at mai

再次进行实时同步操作,运行脚本

rsync实时同步报错rsync error: some files/attrs were not transferred (see previous errors) (code 23) at mai 

上一篇:Redhat6.3利用kickstart无人值守安装


下一篇:inotify事件监控工具