Watching for rsync write files but getting the temp name

From: Chris Williams <chris_at_imnotplayinganymore.com>
Date: Tue, 27 Jul 2010 18:32:00 +0100

Hi,

I've set up a incron watch on a folder which we use to receive files via
rsync from other servers. Here's what I have in my `watchfiles` file in
/etc/incron.d/
 /path/to/dir/10a IN_CLOSE_WRITE /path/to/scripts/linkfiles $@/ $#

and the script `linkfiles` is very simple also...
 #! /bin/bash
 echo "Looking in $1 at $2 " >> /var/log/incron/incron.log
 ln -s $1/$2 /path/to/new/dir/$2

which is all well and good and works when we create files by hand, copy them
in etc. When it fails is when we rsync somthing into that folder. Here's
the log entry
 Looking in /path/to/dir/10a at .myvideo.mp4.Y3iTGF

Augh! As I see it, the IN_CLOSE_WRITE is catching the file as rsync writes
the temp file before it renames it. For some reason it's not catching the
correctly named file (myvideo.mp4) but the temp name one.

Can someone point me in the right direction? Is IN_CLOSE_WRITE the correct
way to do this?

Thanks,

Chris -.

-- 
Chris Williams
 http://imnotplayinganymore.com/
 http://twitter.com/scampiuk
 http://facebook.com/chris.scampi.williams
Received on Tue Jun 05 2012 - 22:14:21 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 22:14:21 CEST