Rsync Real-time Error: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.9]

Inotify + Rsync real-time synchronization error reporting

1. Error message

It can be synchronized normally, but the following error message will appear:

[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]

The script file is as follows:

[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/ [email protected]::wwwroot/"
$INOTIFY_CMD | while read DIRECTORY EVENT FILE
##while Determine if monitoring records are received
do
    if [ $(pgrep rsync | wc -l) -le 0 ] ; then
        $RSYNC_CMD
    fi
done

2. Solution

Enter the configuration file of Rsync server and change uid and GID to root;

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

Restart Rsync service

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

Perform real-time synchronization again and run the script

Similar Posts: