--delete-after-fetch mode?

Martin Pool mbp at samba.org
Mon Apr 8 17:07:02 EST 2002


On  9 Apr 2002, George Michaelson <ggm at apnic.net> wrote:

Please read this first:

  http://www.eyrie.org/~eagle/faqs/questions.html

> I am using rsync to pull maildrop boxes to a laptop.
> 
> when I do this, I really do want to zero/delete the file
> afterward.
> 
> I use rsync because its a lowest common denominator, and its fast
> and reliable.
> 
> But, I have to zero the maildrop afterward. This I do via a script
> but it feels very hinky, much less atomic to having the daemon
> do it.
> 
> None of the --delete-variant seem to work as a pass to the OTHER end
> so the pullee can say :"after you give me this, delete it"
> 
> Is it done/doable?

I think what you want is the proposed --move option, which would
delete the files after they're transferred.  However, your example
points out a critical problem with --move: it will always race with
other applications writing to the file.  If your mail delivery agent
delivers a message while rsync is transferring the file, you might get
none, some, or all of it on the destination, and the rest might be
lost.

If you can ensure that this is not going to happen (by shutting down
the mda or locking the mailbox), or you don't care, then you can do
it.

Either:

 -- use a script, as you already do.

 -- after downloading the file, upload an empty file in its place.
  
 -- implement --move; there might be a patch in the archives but I
    don't remember seeing it.

-- 
Martin 




More information about the rsync mailing list