Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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?

share|improve this answer
    
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 '13 at 14:07
    
Default is 60 seconds... but you can tune that appropriately. –  ewwhite Oct 22 '13 at 14:20
    
Yeah that still does continuous probing I wanted something I little more clever and asynchronous. –  Alex Oct 22 '13 at 15:57

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.