silence errorneous output when not generating reports (#1657)

* silence errorneous output when not generating reports
* remove incorrect variable assignment
* change error messages and logic when reports turned off
* changing warn -> inf

Co-authored-by: Charles Harris
Co-authored-by: Georg Lauterbach
This commit is contained in:
Charles Harris 2020-10-21 12:45:47 -05:00 committed by GitHub
parent da8171388f
commit 451bbfdf40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -170,8 +170,8 @@ function register_functions
_register_setup_function "_setup_environment"
_register_setup_function "_setup_logrotate"
[[ ${PFLOGSUMM_TRIGGER} != "none" ]] && _register_setup_function "_setup_mail_summary"
[[ ${LOGWATCH_TRIGGER} != "none" ]] && _register_setup_function "_setup_logwatch"
_register_setup_function "_setup_mail_summary"
_register_setup_function "_setup_logwatch"
_register_setup_function "_setup_user_patches"
@ -1725,6 +1725,7 @@ function _setup_mail_summary
_notify 'inf' "Add postrotate action for pflogsumm report"
sed -i "s|}| postrotate\n /usr/local/bin/postfix-summary ${HOSTNAME} ${PFLOGSUMM_RECIPIENT} ${PFLOGSUMM_SENDER}\n endscript\n}\n|" /etc/logrotate.d/maillog
;;
"none" ) _notify 'inf' "Postfix log summary reports disabled. You can enable them with 'PFLOGSUMM_TRIGGER=daily_cron' or 'PFLOGSUMM_TRIGGER=logrotate'" ;;
* ) _notify 'err' 'PFLOGSUMM_TRIGGER not found in _setup_mail_summery' ;;
esac
}
@ -1750,6 +1751,7 @@ function _setup_logwatch
>> /etc/cron.weekly/logwatch
chmod 744 /etc/cron.weekly/logwatch
;;
"none" ) _notify 'inf' "Logwatch reports disabled. You can enable them with 'LOGWATCH_INTERVAL=daily' or 'LOGWATCH_INTERVAL=weekly'" ;;
* ) _notify 'warn' 'LOGWATCH_INTERVAL not found in _setup_logwatch' ;;
esac
}