Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Store path to commands
- LOGGER=/usr/bin/logger
- FILE=/opt/app/ebanking/logs/bussines.log
- # Store email settings
- AEMAIL="eder.marcel@slsp.sk"
- ASUB="ERROR LINE - $(hostname)"
- AMESS="Warning - errors found on $(hostname) @ $(date). See log file for the details /opt/app/ebanking/logs/error.log"
- OK_MESS="OK: NO ERROR Found."
- WARN_MESS="ERROR: Error Found."
- # Check if $FILE exists or not
- if test ! -f "$FILE"
- then
- echo "Error - $FILE not found or mcelog is not configured for 64 bit Linux systems."
- exit 1
- fi
- # okay search for errors in file
- error.log=$(grep -c -i "ERROR" $FILE)
- # error found or not?
- if [ $error.log -gt 0 ]
- then # yes error(s) found, let send an email
- echo "$AMESS" | email -s "$ASUB" $AEMAIL
- else # naa, everything looks okay
- echo "$OK_MESS"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement