6

Can someone explain why inotifywait still reports about opened files, when I have excluded open?

mkdir /tmp/a

inotifywait --exclude acess,attrib,close_write,close_nowrite,close,open,moved_to,moved_from,move,delete,delete_self,unmount -r -m /tmp/a/

touch /tmp/a/test
/tmp/a/ OPEN test
/tmp/a/ CLOSE_NOWRITE,CLOSE test

All I am interested in is if new files are made or current files are modified.

I use CentOS 7, if that changes anything.

codeforester
  • 39,467
  • 16
  • 112
  • 140
Jasmine Lognnes
  • 6,597
  • 9
  • 38
  • 58
  • 1
    `--exclude` is for excluding matching *filenames*. It doesn't have anything to do with excluding particular events. See the `inotifywait` man page. – larsks Oct 05 '17 at 12:58

1 Answers1

6

The -e event (Listen for specific event(s) only) is different from the --exclude <pattern> which is meant for not processing any events whose filename matches the specified regular expression. Your actual command needed to be without open on the list of events to watch on. For e.g. if you are interested in only create and modify just do

inotifywait -rme create,modify /tmp/a/

inotifywait(1) - Linux man page

Inian
  • 80,270
  • 14
  • 142
  • 161