From 994d4ae646b434f666390e614fb530104874f5db Mon Sep 17 00:00:00 2001 From: Sushain Cherivirala Date: Thu, 17 Oct 2024 05:33:02 -0500 Subject: [PATCH] Delete duplicate logrotate config for `mail.log` (#214) --- scripts/common-run.sh | 7 +++++++ scripts/run.sh | 1 + 2 files changed, 8 insertions(+) diff --git a/scripts/common-run.sh b/scripts/common-run.sh index 120ad98..9705882 100755 --- a/scripts/common-run.sh +++ b/scripts/common-run.sh @@ -54,6 +54,13 @@ rsyslog_log_format() { sed -i -E "s//${log_format}/" /etc/rsyslog.conf } +logrotate_remove_duplicate_mail_log() { + if egrep -q '^/var/log/mail.log' /etc/logrotate.d/logrotate.conf; then + info "Removing /var/log/mail.log from /etc/logrotate.d/rsyslog" + sed -i -E '/^\/var\/log\/mail.log/d' /etc/logrotate.d/rsyslog + fi +} + anon_email_log() { local anon_email="${ANONYMIZE_EMAILS}" if [[ "${anon_email}" == "true" || "${anon_email}" == "1" || "${anon_email}" == "yes" || "${anon_email}" == "y" ]]; then diff --git a/scripts/run.sh b/scripts/run.sh index f223852..684925b 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -9,6 +9,7 @@ announce_startup # Print startup banner setup_timezone # Check if we need to configure the container timezone check_environment_sane # Check if the the environment is sane rsyslog_log_format # Setup rsyslog output format +logrotate_remove_duplicate_mail_log # Remove duplicate logrotate mail.log entry anon_email_log # Setup email anonymizer setup_conf # Copy over files from /etc/postfix.template to /etc/postfix, if the user mounted the folder manually reown_folders # Make and reown /var/spool/postfix/ folders