Skip to content

Instantly share code, notes, and snippets.

@bborysenko
Forked from FriendlyTester/LogSounds.sh
Created February 5, 2016 14:52
Show Gist options
  • Select an option

  • Save bborysenko/3283682ecdd8cdc8f256 to your computer and use it in GitHub Desktop.

Select an option

Save bborysenko/3283682ecdd8cdc8f256 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