所以我设置了一些代码来观看编辑的配置文件,直到我使用VIM编辑文件,然后我还必须查看重命名和创建的目录.然后我发现在路径层次结构中没有捕获更高的重命名.然后我看了一下符号链接...... gaaahhhh!
首先设置一个示例,显示一个(很多)棘手的符号链接场景:
mkdir config1
touch config1/config
ln -s config1 machine1
mkdir config2
touch config2/config
ln -s config2 machine2
ln -s machine1 active
Run Code Online (Sandbox Code Playgroud)
现在,给定一个我想要观看的像active/config这样的文件名,我可以看到如何获取inotify监视描述符:
config1/ -> watch active/ follow symlinks (watches inode for config1)
active/ -> watch active/ dont follow symlinks (watches inode for active symlink
active/config -> watch active/config (watches inode for config1/config)
Run Code Online (Sandbox Code Playgroud)
如何在machine1符号链接上添加手表?我是否需要找到一些方法来手动遍历每个符号链接为每个添加手表?怎么样?
目的是允许:
mkdir config3
touch config3/config
ln -s -f -n config3 machine1
Run Code Online (Sandbox Code Playgroud)
并且有inotify警告active/config已被重定向.目前看起来我将不得不添加一个手表:
- target file inode
- every directory inode leading to the file (to …Run Code Online (Sandbox Code Playgroud)