1

I was thinking this was going to be rather easy, but it's turn out not to be.

I have a mounted network server that has inotifywatch running on it watching a folder. I was wanting to have this set up so that anyone on the network with access to this server could drop a file into the watched folder and have it execute a script. Unfortunately it doesn't seem to trigger unless the file was moved on the server itself.

Is there any way to make inotify watch a folder in a way that if any file, from anywhere, triggers the inotify event? Or should I look into something else?

For reference, here is what I'm using in a shell script:

inotifywait -m --format '%f' -e moved_to "/mnt/server/folder/" |
while read NAME
do
     echo $NAME
done
Samsquanch
  • 8,560
  • 12
  • 51
  • 86
  • @jwpat7 No event is triggered. I changed the code to `inotifywait -m --format '%e' "/mnt/server/folder/` and moved a file from my machine to the servers watch directory, and no event triggered. I then moved a file from within the server to the watch directory and got a `moved_to` event as I would expect. It might be worth noting that I was SSHed in to move the file when the event fired. When I move a file from my machine within the server (i.e. drag and drop in Finder) no event fires. – Samsquanch Oct 15 '12 at 22:43
  • If on your machine you drag & drop to the watch folder while the inotifywait is running on the server, does inotifywait report events? – James Waldby - jwpat7 Oct 16 '12 at 00:49
  • Refer this http://stackoverflow.com/questions/4231243/inotify-with-nfs – iruvar Oct 16 '12 at 01:11

1 Answers1

0

I ended up setting up rsynch in a cron job to copy over the folder from the network every few minutes, then use inotifywatch to pick up new files from there.

Samsquanch
  • 8,560
  • 12
  • 51
  • 86