`entr`: How is update ID'd? noatime troubles? &, why -r not work with -d?

こ雲淡風輕ζ 提交于 2019-12-11 05:24:46

问题


I have a script regularly appending to a log file. When I use entr (discovered here) to monitor that log file, and I then touch the log, everything works fine, but when the script appends to the file, entr fails. This may be because I have noatime set in my fstab - but that only stops the updating of the access time not the modify time, so this confuses me.

I've checked and while atime is not updating, ctime (ls -lc) definitely is. Could entr really be depending on atime? I use noatime because I have an SSD. So what should I do? I just stumbled on lazytime. Would that solve the problem?

Since monitoring the log file was not working, I tried entr -cdr on the directory of files that are updated (a new file is created) at the same time as the log (the log is in a different directory). entr recognizes when the directory contents change, but the -r does not work. The entr process just ends, saying "entr: directory altered".

Any idea how to fix this or whether I should just go back to inotify, would be appreciated.

Edit: I have written it with inotify now, and the event reported when the log file is written to is, sensibly enough, "MODIFY."


回答1:


It turns out that entr does not respond to IN_MODIFY events, but only to these (in Linux):

IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF|IN_CREATE

Also, IN_ATTRIB, but only if the file-mode or inode numbers change.

In BSD/OSX, it's:

NOTE_DELETE|NOTE_WRITE|NOTE_RENAME|NOTE_TRUNCATE|NOTE_ATTRIB

Also, the option -r has no effect in the context of the -d option. It only works when entr is monitoring files.

See the developer's comments. Also, more info on entr.



来源:https://stackoverflow.com/questions/56454520/entr-how-is-update-idd-noatime-troubles-why-r-not-work-with-d

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