Rsync warning: some files vanished before they could be transferred (code 24) at main.c(1650) [generator=3.1.2]

I run command

/usr/bin/rsync -az -Hhv --progress --delete --numeric-ids user@remote-server-ip:/var/www/html /backups/var/www/html

But something getting error in my cron job

rsync warning: some files vanished before they could be transferred (code 24) at main.c(1650) [generator=3.1.2]

What does this error mean? How can I fix it on CentOS 7 server.

It means files remote-server-ip were either deleted or modified by someone/process. Hence you see the warning. Usually this can be fixed running the rsync command again. There is no command option to prevent this kind of issues.

ignore “vanished files” warning

Some folks would like to ignore the “vanished files” warning, which manifests as an exit-code 24. The easiest way to do this is to create a shell script wrapper. For instance, name this something like “rsync-no24”:

#!/bin/sh
rsync "$@"
e=$?
if test $e = 24; then
    exit 0
fi
exit $e

Taken from here

suppress rsync warning: some files vanished before they could be transferred

Use exclude syntax to ignore dynamically changing files in a given directory.

rsync -avz --exclude '/path/to/dir' user@source:/dest/

See rsync command man page by typing the following command:

man rsync

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki