inotify가 특정 폴더에 대해 작동하지 않습니다

inotify가 특정 폴더에 대해 작동하지 않습니다

내가 무엇을 하든 inotify가 특정 폴더의 변경 사항을 감지할 수 없는 문제가 발생했습니다. 별 차이가 없는 다른 폴더의 변경 사항을 감지합니다. 원인은 무엇일까요?

inotifywait 3.14
Linux titan 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux

inotify는 여기서 예상대로 작동합니다.

터미널에서:

ben@titan:~$ mkdir -p notifytest/example
ben@titan:~$ cd notifytest
ben@titan:~/notifytest$ inotifywait -rme attrib,modify,move,create,delete . --exclude '(log|[a-z]+.sqlite)'

다른 터미널에서:

ben@titan:~$ cd notifytest
ben@titan:~/notifytest$ touch test.txt
ben@titan:~/notifytest$ touch example/test.txt
ben@titan:~/notifytest$ rm example/test.txt
ben@titan:~/notifytest$ rm test.txt

산출:

Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
./ CREATE test.txt
./ ATTRIB test.txt
./example/ CREATE test.txt
./example/ ATTRIB test.txt
./example/ DELETE test.txt
./ DELETE test.txt

여기서는 inotify가 예상대로 작동하지 않습니다.

blog무시되는 기존 폴더가 있습니다 . :(

라는 새 폴더를 만들었고 example올바르게 시청되고 있습니다.

터미널에서:

ben@titan:~$ cd some-path
ben@titan:~/some-path$ ls
drwxr-xr-x 3 ben     ben      4096 Aug 16 14:23 blog
-rw-r--r-- 1 ben     ben     17408 Aug 15 13:58 blog.sqlite
-rw-r--r-- 1 ben     ben       325 Aug 15 13:01 config.py
-rw-r--r-- 1 www-run www-run 91800 Aug 16 14:23 log
drwxr-xr-x 2 ben     ben      4096 Aug 15 14:14 public_html
-rw-r--r-- 1 ben     ben      1999 Aug 15 16:21 schema.sql
-rwxr-xr-x 1 ben     ben      6019 Aug 16 14:01 start.py
ben@titan:~/some-path$ mkdir example
ben@titan:~/some-path$ ls
drwxr-xr-x 3 ben     ben      4096 Aug 16 14:23 blog
-rw-r--r-- 1 ben     ben     17408 Aug 15 13:58 blog.sqlite
-rw-r--r-- 1 ben     ben       325 Aug 15 13:01 config.py
drwxr-xr-x 2 ben     ben      4096 Aug 16 14:28 example
-rw-r--r-- 1 www-run www-run 91800 Aug 16 14:23 log
drwxr-xr-x 2 ben     ben      4096 Aug 15 14:14 public_html
-rw-r--r-- 1 ben     ben      1999 Aug 15 16:21 schema.sql
-rwxr-xr-x 1 ben     ben      6019 Aug 16 14:01 start.py
ben@titan:~/some-path$ file example
example: directory
ben@titan:~/some-path$ file blog
blog: directory
ben@titan:~/some-path$ inotifywait -rme attrib,modify,move,create,delete . --exclude '(log|[a-z]+.sqlite)'

다른 터미널에서:

ben@titan:~$ cd some-path
ben@titan:~/some-path$ touch test.txt
ben@titan:~/some-path$ touch blog/test.txt
ben@titan:~/some-path$ touch example/test.txt
ben@titan:~/some-path$ rm test.txt
ben@titan:~/some-path$ rm blog/test.txt 
ben@titan:~/some-path$ rm example/test.txt 

산출:

inotifywait -rme attrib,modify,move,create,delete . --exclude '(log|[a-z]+.sqlite)'
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
./ CREATE test.txt
./ ATTRIB test.txt
./example/ CREATE test.txt
./example/ ATTRIB test.txt
./ DELETE test.txt
./example/ DELETE test.txt

예상 출력:

inotifywait -rme attrib,modify,move,create,delete . --exclude '(log|[a-z]+.sqlite)'
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
./ CREATE test.txt
./ ATTRIB test.txt
./example/ CREATE test.txt
./example/ ATTRIB test.txt
./blog/ CREATE test.txt
./blog/ ATTRIB test.txt
./ DELETE test.txt
./example/ DELETE test.txt
./blog/ DELETE test.txt

답변1

패턴 --exclude (log)이 일치합니다 b**log**.

대신 사용하십시오 ^log$.

관련 정보