1

I have an rsync command that I run hourly via cron, and to prevent it from having multiple simultaneous rsyncs (should the previous hour's rsync still be running when the next hour comes around) I've wrapped it in an flock. My issue is that despite specifying an exclude filter that should prevent temporary files from being copied, I get 'file has vanished' messages output that seem to indicate they would have been copied (if they were still present).

Here's my script (being run by cron):

#! /bin/sh
cd /blah/data
flock -n .rsync_lock -c "rsync $1 -xa --exclude '/tmp*' --ignore-existing jcr/datastore remote-host:data/jcr"

And here's the output I get:

file has vanished: "/blah/data/jcr/datastore/tmp1774058021534447273.tmp"
file has vanished: "/blah/data/jcr/datastore/tmp2911761408812578785.tmp"
file has vanished: "/blah/data/jcr/datastore/tmp3744586075822519088.tmp"
file has vanished: "/blah/data/jcr/datastore/tmp6622502546708007750.tmp"
file has vanished: "/blah/data/jcr/datastore/tmp8270853704354349176.tmp"
rsync warning: some files vanished before they could be transferred (code 24) at main.c(977) [sender=2.6.9]

Why isn't my exclude filter stopping these files from being considered for transfer? Is this a weird bash quoting issue?

user9517
  • 115,471
  • 20
  • 215
  • 297

1 Answers1

0

If you want to exclude those files your exclude pattern needs to be */tmp*.tmp.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • Even though the files are in the base source directory specified for the rsync? Base: jcr/datastore File: jcr/datastore/tmp8270853704354349176.tmp – Trevor Horsfall Feb 08 '13 at 01:13