Created
July 2, 2016 10:08
-
-
Save handakumbura/86ca262b00239210a992e0d1d4e6c300 to your computer and use it in GitHub Desktop.
this script checks the existence of a char sequence in the last X number of lines of a files and plays a wave file if a match is made.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#this script checks the existence of a char sequence in the last X number of lines of a files and plays a wave file if a match is made. | |
# sh logchecker.sh <number of lines to tail at one go> <logfile> <char sequence> <wav file to play> | |
while [ 1 -gt 0 ]; do | |
tail -n $1 $2 | grep -e "$3" | |
if [ $? -lt 1 ]; then | |
aplay $4 ; | |
exit ; | |
fi | |
sleep 10; #check interval | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment