- 论坛徽章:
- 12
|
无意中发现的灵异问题,哪位大能来解解惑?inotifywait到底是啥原理?没弄明白
实验步骤很简单,如下:
终端1:- $ touch test
- $ inotifywait -m test
- Setting up watches.
- Watches established.
复制代码 终端2:终端1,此时一切正常,能正常监视:- $ inotifywait -m test
- Setting up watches.
- Watches established.
- test MODIFY
- test OPEN
- test MODIFY
- test CLOSE_WRITE,CLOSE
复制代码 终端2,使用vim打开test终端1,此时仍然能监视到事件:- $ inotifywait -m test
- Setting up watches.
- Watches established.
- test MODIFY
- test OPEN
- test MODIFY
- test CLOSE_WRITE,CLOSE
- test OPEN
- test CLOSE_NOWRITE,CLOSE
- test OPEN
- test ACCESS
- test CLOSE_NOWRITE,CLOSE
复制代码 终端2,我在随便往test里写入内容之后,:wq退出。
终端1,此时仍然ok,能够正常监视此次事件:- $ inotifywait -m test
- Setting up watches.
- Watches established.
- test MODIFY
- test OPEN
- test MODIFY
- test CLOSE_WRITE,CLOSE
- test OPEN
- test CLOSE_NOWRITE,CLOSE
- test OPEN
- test ACCESS
- test CLOSE_NOWRITE,CLOSE
- test OPEN
- test CLOSE_NOWRITE,CLOSE
- test ATTRIB
- test DELETE_SELF
复制代码 终端2,当我继续往test里echo,或者重新使用vim打开test,inotifywait好似患了老年痴呆症一般,傻了。终端1,没有任何反应:- [code]$ inotifywait -m test
- Setting up watches.
- Watches established.
- test MODIFY
- test OPEN
- test MODIFY
- test CLOSE_WRITE,CLOSE
- test OPEN
- test CLOSE_NOWRITE,CLOSE
- test OPEN
- test ACCESS
- test CLOSE_NOWRITE,CLOSE
- test OPEN
- test CLOSE_NOWRITE,CLOSE
- test ATTRIB
- test DELETE_SELF
复制代码 [/code]
|
|