Permalink
Browse files

don't send email if there are only few matches

  • Loading branch information...
danielnaber committed Nov 16, 2016
1 parent ba591f8 commit 386ade9118bd92e079deb68c00cd236a7c3e0c14
Showing with 6 additions and 2 deletions.
  1. +6 −2 mail_errors_hourly.sh
View
@@ -3,9 +3,13 @@
FIRSTPART=naber
LASTPART=danielnaber.de
LIMIT=10
tail -n 100000 tomcat2/logs/catalina.out | grep "`date +"%Y-%m-%d %H:"`" tomcat2/logs/catalina.out | egrep "ERROR|SEVERE" >/tmp/hourly_error_data.txt
MATCHES=`cat /tmp/hourly_error_data.txt | wc -l`
cat /tmp/hourly_error_data.txt | tail -n 100 | \
ifne mail -a 'Content-Type: text/plain; charset=utf-8' -s "Hourly OpenThesaurus Error Report ($MATCHES total)" ${FIRSTPART}@${LASTPART}
if [ "$MATCHES" -gt "$LIMIT" ]
then
cat /tmp/hourly_error_data.txt | tail -n 100 | \
ifne mail -a 'Content-Type: text/plain; charset=utf-8' -s "Hourly OpenThesaurus Error Report ($MATCHES total)" ${FIRSTPART}@${LASTPART}
fi

0 comments on commit 386ade9

Please sign in to comment.