Simon
2005-Jan-14 16:02 UTC
--delete & --files-from can't be used as a purge list. Alternate strategy suggestions?
Hi, N.B. rsync version 2.6.2 on Linux, no rsync server, using SSH THE PROBLEM rsync --delete --files-from=<FILES_ON_MASTER_TO_BE_DEL_AND_NOT_ON_SECONDARY> -e ssh -... <SECONDARY_HOST>:<BASEDIR> <BASEDIR> generates error: receiving file list ... link_stat "<EXAMPLE_FILE_NOT_ON_SECONDARY" failed: No such file or directory and does not have the desired effect of deleting the remote file EXAMPLE_FILE_NOT_ON_SECONDARY on the MASTER host. Looking around it would appear --delete works upon directory updates, but there is nothing in the documentation that indicates that options in the example above cannot be used in this way. Can anybody suggest alternative strategies to achieve a similar effect? THE BACKGROUND In lieu of bidirectional synchronisation capabilities I am approximating with: Full: * Full rsync with --delete from master to secondary after doing an incremental. Incremental: * Update secondary to master with --files-from based on secondary find . -newer <marker from full sync> * Update master to secondary with --files-from based on master find . -newer <marker from full sync> I wish to enhance this to try a limit transient files on the secondary migrating to the master by accumulating the list of files created / updated on the secondary, and if these were subsequently deleted on the secondary then any copies propogated to the master should be deleted, so: * (after incremental) update secondary to master with --delete and --files-from based on secondary accumulation Thanks for any help, Simon
Wayne Davison
2005-Jan-14 19:56 UTC
--delete & --files-from can't be used as a purge list. Alternate strategy suggestions?
On Fri, Jan 14, 2005 at 04:02:39PM +0000, Simon wrote:> Looking around it would appear --delete works upon directory updates, > but there is nothing in the documentation that indicates that options > in the example above cannot be used in this way.I've updated the docs for the next release to make this clearer.> Can anybody suggest alternative strategies to achieve a similar effect?If you're tyring to run this rsync command to remove remote files: rsync -av --files-from=files-to-delete / somehost:/dest/dir this pipeline will actually do that job: sed 's:^/::' files-to-delete | ssh somehost 'cd /dest/dir; xargs rm' That lets you use a list of relative filenames that are read-in from a file on the local system and delete them on the remote system. The sed command may not be needed in your setup, but I include it because rsync strips leading slashes from the files it reads via --files-from. You may also wish to add the "-r" optionto "rm" if you want to remove dirs. ..wayne..