From 3e913e5887b8b998649d1c356efb98ba1082c53d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 May 2018 21:11:50 +0100 Subject: [PATCH] Prevent mail processes from proliferating --- src/freedombone-base-email | 11 +++++++++++ src/freedombone-upgrade | 1 + 2 files changed, 12 insertions(+) diff --git a/src/freedombone-base-email b/src/freedombone-base-email index ab0e5262..45b33ec9 100755 --- a/src/freedombone-base-email +++ b/src/freedombone-base-email @@ -1663,6 +1663,16 @@ function refresh_gpg_keys { fi } +function prevent_mail_process_overrun { + { echo '#!/bin/bash'; + echo "exim_ctr=\$(pgrep \"exim4\" | wc -l)"; + echo "if [ \"\$exim_ctr\" -gt 5 ]; then"; + echo ' exim -bp | exiqgrep -i | xargs exim -Mrm'; + echo 'fi'; } > /usr/bin/exim_check + chmod +x /usr/bin/exim_check + cron_add_mins 5 '/usr/bin/exim_check' +} + function install_email { if [[ $SYSTEM_TYPE == "mesh"* ]]; then return @@ -1675,6 +1685,7 @@ function install_email { check_email_address_exists install_email_basic configure_email_onion + prevent_mail_process_overrun mark_completed "${FUNCNAME[0]}" } diff --git a/src/freedombone-upgrade b/src/freedombone-upgrade index 2c851154..19326753 100755 --- a/src/freedombone-upgrade +++ b/src/freedombone-upgrade @@ -102,6 +102,7 @@ if [ -d "$PROJECT_DIR" ]; then email_disable_chunking rm /etc/exim4/exim4.conf.template.bak* email_update_onion_domain + prevent_mail_process_overrun #defrag_filesystem # reinstall tor from backports