bashshellinotify

inotify with network server


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

Solution

  • 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.