Created
July 9, 2012 13:08
-
-
Save jacksoncage/3076459 to your computer and use it in GitHub Desktop.
Shell script to look for error in log web server log files
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/bash | |
# Shell script to look for error in log web server log files | |
# ------------------------------------------------------------------------- | |
# http://www.linuxforums.org/forum/red-hat-fedora-linux/166780-shell-script-send-email.html | |
# ------------------------------------------------------------------------- | |
tail -f -n0 <log-filename> | while read line ; do | |
if [ $(echo $line | grep -i 'ERROR' | wc -l) != 0 ]; then | |
(echo "Subject: Fix: Web Server Error"; echo; echo $line) | mail adm@lovemusic.se | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment