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."
It turns out that
entr
does not respond to IN_MODIFY events, but only to these (in Linux):Also, IN_ATTRIB, but only if the file-mode or inode numbers change.
In BSD/OSX, it's:
Also, the option
-r
has no effect in the context of the-d
option. It only works whenentr
is monitoring files.See the developer's comments. Also, more info on entr.