I have this inotifywait command watching a log file, once triggered runs some other code which takes 0.2s to complete. This works fine when the log is not being massively updated, but when there's more than a few new entries, the code is being repeated over and over unnecessarily.
What I'm trying to achieve is, as the title states, to limit the number of inotify triggers to a maximum of (specifically to this case, given the .2s execution time) 5 times per second.
I've tried to search in the inotify documentation but there doesn't seem to be any function doing such, so I guess I'm stuck working something out within Bash itself.
How would you suggest approaching this? Would using the internal $SECOND tied to a while loop with a counter be a viable option?