0

I'm trying to find a way for an email notification in awstats.

The idea is that whenever there's an error (missing log files, statistics couldn't be generated) an email with an error message should be send to a specific email address.

I already found the config-Attribute "ErrorMessages" but as far as i get it its just for displaying an error.

Is there an attribute like "ErrorMessages" for activating mail notifications or do i have to implement it myself?

Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58

2 Answers2

0

You can use cron job to run awstats update proccess. And it'll sent update process result via email to you. Example: * * * * * /usr/local/awstats/update.sh | mail abc@xzy.com

Dieu Luong
  • 133
  • 3
  • 12
0

I found a way to trap Errors while my code is executed. It's not an awstats feature, more a generic way:

Inside my script:

#Error Handling
set -e
function sendErrorNotification(){
        echo "Awstats: An error occured during processing server logs." | mail  -s "AWSTATS ERROR" "...@..."
    }
trap sendErrorNotification EXIT    

....code goes here...

set +e
trap - EXIT
  • Could you please elaborate more your answer adding a little more description about the solution you provide? – abarisone May 11 '15 at 11:59