Last active
November 1, 2017 03:00
-
-
Save djch/f9a52fe30093d417b687 to your computer and use it in GitHub Desktop.
Monitor a log for a thing which triggers another thing
This file contains 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/sh | |
# | |
# You can start the script on boot, in the background, by adding it to /etc/rc.local: | |
# echo -e "/path/to/logmon.sh &\n" >> /etc/rc.local | |
# | |
tail -Fn0 /path/to/that/logfile.log | \ | |
while read line ; do | |
echo "$line" | grep "thing" | |
if [ $? = 0 ] | |
then | |
/bin/trigger-sumthin | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment