Best approach to detecting a move or rename to a file in Linux?

限于喜欢 提交于 2019-12-01 21:19:58

Look into inotify which allows you to get a call when anybody does anything to files in a specified file system or directory.

Notice that this will be filesystem dependent. It is doable in ext3 and similar filesystems, but maybe not in others. This is probably also a rather resource hungry operation since it needs to scan through the disk to check all inodes, so you need to look up a solution to be notified when inodes are changed (instead of scanning through them all).

logroate use mv command, there have a article to explain why the fd not change when the file be moved How do the UNIX commands mv and rm work with open files?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!