I have a server and a local PC. When the local PC boots up, I run the following script to display the output from the server logs locally on the PC.
/usr/bin/ssh -p '444' 'user@remoteserver' "tail -f /log/short.log"
So far everything works great, but what I would like to do is to also pass this output to another background script each time a new line arrives in the "tail". The background script would then check if the given line contains any keywords, and if it's a match, then it would play a sound, while the original tail would still work and list the data on the screen as previously.
The script for checking keywords/playing audio I can do easily, but the part that I don't understand is how can I pass each new line to my script and still have the output printed on the screen.