Skip to content

Instantly share code, notes, and snippets.

@FriendlyTester
Last active July 2, 2021 08:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save FriendlyTester/f76722aeee286cfaeade to your computer and use it in GitHub Desktop.
Save FriendlyTester/f76722aeee286cfaeade to your computer and use it in GitHub Desktop.
Shell Script To Play Sounds On Word Match
tail -n 0 -f log.txt | grep --line-buffered 'ERROR' | while read line; do afplay beep-01a.wav; done
#log.txt this is the log file you want to tail. Full path if not in that directory
#'ERROR' is the stirng you are looking to match
#beep-01a.wav is the sound to play when string matched. Full path if not in that directory
#Maik later responded saying his logfile was on a remote server, he discovered the following worked to tail a remote file
ssh <user@remoteserver> tail -n 0 -f log.txt | grep --line-buffered 'ERROR' | while read line; do afplay beep-01a.wav; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment