Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOG_FILE=/var/log/sample.log
- ERROR_FILE=errors_$(date +%d-%m-%y).log
- TO_EMAIL_ADDRESS=ops@example.com
- FROM_EMAIL_ADDRESS=from@example.com
- LIMIT_SIZE=10240
- ERROR_FILE_SIZE=du $ERROR_FILE
- function get_errors {
- grep ERROR $LOG_FILE |while read line
- do
- echo $line >> $ERROR_FILE
- done
- }
- function send_mail {
- }
- function send_error_mail {
- }
- get_errors
- if [[ $ERROR_FILE_SIZE -lt $LIMIT_SIZE ]]
- then send_mail
- else
- send_error_mail
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement