Linux 如何只收听inotifywait中的特定事件?
有人能解释一下为什么当我排除了open时,Linux 如何只收听inotifywait中的特定事件?,linux,bash,centos,inotify,inotifywait,Linux,Bash,Centos,Inotify,Inotifywait,有人能解释一下为什么当我排除了open时,inotifywait仍然报告打开的文件吗 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_NOWR
inotifywait
仍然报告打开的文件吗
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
所有我感兴趣的是,如果新的文件或当前文件被修改
如果有任何变化,我使用CentOS 7。-e事件(仅侦听特定事件)与--exclude
不同,后者用于不处理文件名与指定正则表达式匹配的任何事件。您的实际命令需要在事件列表中没有open
才能监视。例如,如果您只对创建
和修改
感兴趣,只需执行即可
inotifywait -rme create,modify /tmp/a/
--exclude
用于排除匹配的文件名。它与排除特定事件无关。请参阅inotifywait
手册页。