1

I am trying to figure out a way to notice when a certain file is written to on the network folder mounted. I am aware that one can continuously probe the location to see if it has been created but that's very nice. I am also aware that one can use inotify, and derivatives of it like iwatch and inotify-tools, to look for kernel flags. However, it is a network folder the flags are not raised on the machine where the folder is mounted to.

So I was wondering if there are other ways to do this. I was thinking maybe use messaging queues like RabbutMQ. Check when the files are written and send message to a queue then read the message on mounted machine and do whatever?

2 Answers 2

1

If you don't think the inotify suite of tools are appropriate here, and you're using Linux, try Monit and an existence or filesystem test against the remote share.

 check file with path /nfs/appdata.txt
   if does exist then alert 

Maybe a cleaner example here. Is the filename known or not?

3
  • I just read the intro to Monit (mmonit.com/monit/documentation/monit.pdf) and it wants a poll interval. So am I right in thinking it will just probe every X seconds?
    – Alex
    Oct 22, 2013 at 14:07
  • Default is 60 seconds... but you can tune that appropriately.
    – ewwhite
    Oct 22, 2013 at 14:20
  • Yeah that still does continuous probing I wanted something I little more clever and asynchronous.
    – Alex
    Oct 22, 2013 at 15:57
0

There is no way for a client to get notified when the mounted directory changed on the server (well, nfs v4.1 spec has a way to do it, but there are no implementations doing this). You have to poll.

If you can run a special applications on the server, then you can use something like lsync and have a custom handler to notify client with a mechanism of your choice.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .