Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

inotify

ctime

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."

like image 561
Diagon Avatar asked Jan 23 '26 11:01

Diagon


1 Answers

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.

like image 91
Diagon Avatar answered Jan 26 '26 18:01

Diagon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!