#!/bin/bash if ! cd $DATA/logs; then echo "Could not cd to Log directory $DATA/logs" exit 1 fi if [[ ! -e all-portal2.log ]] ; then echo "all-portal2.log does not exist in `pwd`" exit 1 fi echo "Checking logs at $DATA/logs on `whoami`@`hostname`" > /tmp/founderrors.txt counter=0 if grep "POST WORK" all-portal2.log >> /tmp/founderrors.txt ; then echo "found POST WORK" let "counter = counter + 1" fi if grep "Configured host" all-portal2.log >> /tmp/founderrors.txt ; then echo "found Configured host" let "counter = counter + 1" fi if [[ $counter > 0 ]] ; then mail -s "Important Errors in logs on `whoami`@`hostname`" terri@sdsc.edu < /tmp/founderrors.txt fi