简体   繁体   中英

Programmatically Trigger an inotify event on linux

Using shared folders on VirtualBox (or pretty much any VM) will not trigger inotify events on the guest OS when a file is changed on the host OS.

But if it's possible to programmatically trigger an inotify event then I can write a something (virtualbox plugin, client/server, etc) to tell linux (in this case Ubuntu) that the file has changed. This would allow any existing software that watches for file changes (ruby's guard, python's watchdog, node-watcher, etc) to work with shared folders and increase development speed.

language doesn't matter (but would prefer node given the ease of install across host OS's). if anyone knows how to accomplish would greatly appreciate it.

sed '' -i filename

此命令触发一个inotify更改事件,但不更改文件的内容

touch -r file.ext file.ext

this will "update" the modification time of the file, but sets it to its own existing modification time. so, nothing is actually changed about the file or its metadata, yet inotify sees a "change".

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