jadent
jadent

Reputation: 3894

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.

Upvotes: 5

Views: 2924

Answers (2)

y o
y o

Reputation: 1163

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".

Upvotes: 2

Eisa Qasemi
Eisa Qasemi

Reputation: 826

sed '' -i filename

this command trigger an inotify change event but does not change the content of file

Upvotes: 3

Related Questions