Page 1 of 1

How to act every time a file is (re)-created with some words

PostPosted: Wed Dec 14, 2022 10:05 pm
by halloleo
I have a file /usr/local/var/log/locate/upd_locatedbs_core.log which is created every night. Normally it does not contain the string "Excluding ALL external volumes". When it does, I want to show a notification (via a shell script).

I created the following rule watching the folder /usr/local/var/log/locate/:

Image

This works -- but only once: When I delete the file and recreate it (either by writing to it or by copying it), nothing happens again. However that's exactly what I want to test for: Whether the file was (re)created with a certain content....

Any idea how I can fix this? Many thanks in advance!

Re: How to act every time a file is (re)-created with some w

PostPosted: Thu Dec 15, 2022 10:45 am
by Mr_Noodle
Try adding a condition like "Date last modified is after date last matched"

Re: How to act every time a file is (re)-created with some w

PostPosted: Thu Dec 15, 2022 9:03 pm
by halloleo
Mr_Noodle wrote:Try adding a condition like "Date last modified is after date last matched"


Cool! Thanks.