5

I want to monitor changes made a folder that is mounted via SSHFS.

I have tried iwatch but it does not notify when a new file is created, below is the syntax I am using with iwatch:

iwatch -e create /mnt/mme01/

Any idea why this is not working and how it can be achieved?

Thushi
  • 9,498
  • This may solve your problem: http://unix.stackexchange.com/questions/208206/copy-the-files-automatically-to-destination-as-soon-as-created/208214 – Petr Skocik Jun 10 '15 at 12:47

1 Answers1

7

SSHFS doesn't implement the inotify API. Making that work would require a fundamental redesign for two reasons:

  • SSHFS uses SFTP to communicate with the server. The SFTP protocol has no facility to be notified of file changes on the server side. The server might not even have a file change notification mechanism — this could be made an optional feature of the protocol, but SFTP simply doesn't include this.
  • SSHFS is built on FUSE, and FUSE doesn't provide an interface to inotify, so FUSE filesystems will never generate any inotify events.

You'll have to set up your watch on the server side.

ssh server.example.com inotifywait -m -e create /path/to/mme01 | …