[CentOS-devel] inotify - triggering scripts based on file events

Sun Mar 6 16:23:23 UTC 2016
Nico Kadel-Garcia <nkadel at gmail.com>

On Sun, Mar 6, 2016 at 9:13 AM, michael gordon <mgordonabc at gmail.com> wrote:
> We allow our third party clients to upload files for processing via ftp.
> Once the file is done a java app is triggered to process the file and move
> it to a processed folder. How do we know when the file is done writing,the
> file events  we have observed include create, modify.  These dont help since
> the ftp program writes file contents in blocks and then triggers the
> modified event, there is no finish event.
>
> What can you recommend

"rsync -n" between the upload and target repository to verify changes,
and "rsync" to complete the file transfer, work pretty well. Be
careful with the options, rsync will optimize based on file size and
datestamps without doing an actual checksum if the options are chosen
carelessly, and this can cause problems with certain classes of
identically sized and datestamped but distinct files.