I am using Zoneminder (ZM) to monitor the cameras around my property and am trying to find a method to monitor the image directory that ZM uses to store image files of recorded motion events. The program creates a new directory for each event and places numerous (sometimes 100’s) images in the directory with a format such as 00094-capture.jpg. However, in each folder there is one that is always named “snapshot.jpg”.
I would like to know of a way to monitor for the creation/addition of that image. The directory structure I would need to monitor may make this task difficult. I don’t really know. I’m just a yearling when it comes to Linux. But the structure is like this ….
/events/2/2024-05-14/88/snapshot.jpg
/events/2/2024-05-14/89/snapshot.jpg
/events/2/2024-05-14/90/snapshot.jpg //notice date change
/events/2/2024-05-15/91/snapshot.jpg
/events/2/2024-05-15/92/snapshot.jpg
Any thoughts on a way to accomplish something like this?
The main goal is to have only the one file trigger the monitoring script/program.
And just before I click on the preview button, it occurred to me that maybe one could monitor for the creation of a the new event directory. But the first event of the day would have 2 hits. One for the date named directory. Another for the numbered directory. Which would not at all be unacceptable. Just not preferred.
Thanks!
I’ve looked into incron and inotifywait. However, I didn’t happen to see a way to monitor for a specific file name.