简体   繁体   中英

Trigger inotify file change event

How can I trigger linux inotify() file change event programmatically, without real read/write operation?

Inotify man page has only watching functions.

Actually I have to do it without any file operation. Maybe there is a possibility to do this via some system call ?

You can change attributes to trigger an event for inotify() to report. You might change permissions, for example.

I used udev rules to write to a file upon thumb drive insertion, then inotify() to detect that write, and kicked off scripts to process everything on the drive, all without user interaction. inotify() is a very useful call.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM