[RndTbl] rsync with multi-direction delete.

John Lange john.lange at open-it.ca
Mon Sep 17 15:47:45 CDT 2007


The situation you are in is exactly the way I've been running mine for a
few years now.

The solution is... There isn't one. I just don't ever delete anything.
Seriously.

If I really need to delete something I log into the server and the
client machine(s) and manually delete the file at the same time.

This is reasonable when you have one master and maybe at most a couple
clients but any more than that and it's a real problem.

I've had it in mind that the solution is to add some logic to the script
so that it checks to see if there are any files with a ".deleted"
extension and then ssh into the server and delete those files first
before doing the rsync.

But it's really quite rare that I delete documents and so I've never
been motivated to actually implement this.

So, just thinking out loud; something along the lines of:

for FN in `ls *.deleted`
 do ssh <remotemachine> rm `basename $FN .deleted`
done

Then do the rsync.

Note; THIS IS NOT REAL CODE but it might inspire you to get something
working.

John

On Mon, 2007-09-17 at 14:16 -0500, Montana Quiring wrote:
> Hello,
> 
> I've started working with rsync and I'm close to getting things the
> way I want it, but I need a  bit of help from an expert to finish the
> project.
> 
> I'm rsyncing from a directory on a server to a usb mass-storage device
> attached to a different computer. I'm running an rsync daemon on the
> server and I'm able to successfully synchronize the contents of a
> directory on the server to a directory on the usb device.
> 
> What I want: when I delete a file or directory on either place it will
> remove it from the other.
> What it does now: If I delete a directory or file from the server it
> removes it from the USB device (ya!) but if I remove a file/directory
> from the USB device and perform an rsync it replaces the deleted
> file/directory.
> 
> Here is the rsync command I'm using:
> rsync --delete --delete-excluded --recursive -uv
> quiringm at 192.168.1.102:/mnt/hdd/music/podcasts/ /Volumes/MEK/Podcasts/
> 
> Thanks in advance for your help,
> -Montana
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.mb.ca
> http://www.muug.mb.ca/mailman/listinfo/roundtable




More information about the Roundtable mailing list