inotify missing events

后端 未结 3 1504
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-25 12:24

I want to monitor USB-Keys on my system. I know they are always mounted in /media so I use inotify to monitor /media. Some USB Keys create a folder (e.g. sda) when plugged which

3条回答
  •  不要未来只要你来
    2021-01-25 13:07

    1. You can use inotifywait command (from the inotify-tools package) to monitor the /media directory, in order to check whether the inotify events which interest you do occur.
      reference:
      http://www.noah.org/wiki/Inotify,_FAM,_Gamin#Examples_with_inotify-tools

    2. If inotify does miss events, the reason might be:
      Inotify does report some but not all events in sysfs and procfs.
      (Well, I can not say for sure. Just my guess.)

    Reference:
    http://en.wikipedia.org/wiki/Inotify#Limitations
    http://en.wikipedia.org/wiki/Sysfs
    http://en.wikipedia.org/wiki/Procfs

提交回复
热议问题