3

I tried to make myself a small shell script that would watch for file changes using inotifywait and copy modified/created files and delete deleted files to some destination folder (or rsync specific file). I was not able to make this work.

Investigation: inotifywait is able to detect modifications when I'm editing/deleting/creating files using nano/vim/touch/rm. The problem emerges when I modify/create/delete a file using Visual Studio Code. When I try to watch -d stat some_file, I can see all the modifications happening even when using Visual Studio Code - inotifywait does not detect anything.

I'm not able to figure out what's the problem since I'm not super familiar with Linux.

I would like to be able to use inotifywait since I want to watch for changes in nearly 28000 files. I don't want to use some hybrid of watch, ls, find, stat since iterating whole dir recursively is slow on Virtual Box shared folder. Also fs.inotify.max_user_watches was increased to a sufficient number.

To be complete, here is simplified used command:

$ inotifywait --monitor --recursive /share/repo/
gnivirht
  • 315
  • 2
  • 9

0 Answers0