I want to monitor a log file (omxd log file) in real time, and execute some commands when some sentences appear in the log.
I searched this site (and many other sites) and these are what I tried:
tail -f /var/log/omxlog | awk '/player_new/ { "echo hello" }'
or
stdbuf -o0 tail -F /var/log/omxlog | awk '/player_new/ { "echo hello" }'
But they don't work. Whenever I run these commands, it begins to wait, but although I'm sure the log file changes, it doesn't print hello; actually it doesn't do anything. Just waiting :D
Maybe the problem is that I'm accessing the RPi via SSH. I don't know.
So, what should I do!?
(System: Raspberry Pi. OS: Minibian)