Linux – Watching a Samba share for modifications from Linux

linuxnotificationssamba

I'm trying to monitor a remote Windows Share for changes (the server can be an actual Windows machine or a Linux machine with Samba server). AFAIK the SMB protocol supports a kind of event-based notification:

http://msdn.microsoft.com/en-us/library/jj216044.aspx

And I can find it implemented server-side in Samba in the change_notify option in smb.conf.

My question is: how can I watch for such events from the client side from a Linux machine? I'd like to setup something that works in a fashion similar to inotifywait and be notified with an event when the content of files on the share changes, or when files are created, deleted or moved.

Best Answer

an idea is to use Inotify on linux to monitor changing on filesystem.

As SAMBA 3.0.23 (http://wiki.samba.org/index.php/Samba_3.0_Features_added/changed), the protocol now support Inotify, server site, to notify compatible client of filesystem changing.

But, as https://lkml.org/lkml/2007/4/7/129, seems that actually CIFS client does not support correctly Inotify.