[GTALUG] Watching a network folder: is there a smart way of doing this?

Stewart C. Russell scruss at gmail.com
Tue Mar 14 15:34:03 EDT 2017


In my search for the perfect (or at least, “working”) changed file
protocol, Chris Tyler pointed me towards something that other list users
might find useful: incron

The cron part of the name is a bit misleading, as it's not triggered
periodically, but by inotify events. Chris noted that watching for
IN_CLOSE_WRITE events (file open for writing was closed) is a fairly
efficient way of tracking new files. Each incron command target gets
passed the name of the particular file via an environment variable.

I'm having to use rsync to move the files from the scanner CIFS share,
as its behaviour is just too random for scripting directly.

 Stewart

(props to Chris for giving a compelling Raspberry Pi meetup talk at the
end of a 40+ hour software release run, and sticking around to answer
questions coherently when he was clearly craving sleep.)



More information about the talk mailing list