From 451bbfdf40a47d20f9cde6a4b2ce309bf3c36cbe Mon Sep 17 00:00:00 2001 From: Charles Harris <72926946+erdos4d@users.noreply.github.com> Date: Wed, 21 Oct 2020 12:45:47 -0500 Subject: [PATCH] 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 --- target/start-mailserver.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 16dd7d95..9fab3e47 100755 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -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 }