Browse Source

Prevent mail processes from proliferating

Bob Mottram 6 years ago
parent
commit
3e913e5887
2 changed files with 12 additions and 0 deletions
  1. 11
    0
      src/freedombone-base-email
  2. 1
    0
      src/freedombone-upgrade

+ 11
- 0
src/freedombone-base-email View File

@@ -1663,6 +1663,16 @@ function refresh_gpg_keys {
1663 1663
     fi
1664 1664
 }
1665 1665
 
1666
+function prevent_mail_process_overrun {
1667
+    { echo '#!/bin/bash';
1668
+      echo "exim_ctr=\$(pgrep \"exim4\" | wc -l)";
1669
+      echo "if [ \"\$exim_ctr\" -gt 5 ]; then";
1670
+      echo '    exim -bp | exiqgrep -i | xargs exim -Mrm';
1671
+      echo 'fi'; } > /usr/bin/exim_check
1672
+    chmod +x /usr/bin/exim_check
1673
+    cron_add_mins 5 '/usr/bin/exim_check'
1674
+}
1675
+
1666 1676
 function install_email {
1667 1677
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
1668 1678
         return
@@ -1675,6 +1685,7 @@ function install_email {
1675 1685
     check_email_address_exists
1676 1686
     install_email_basic
1677 1687
     configure_email_onion
1688
+    prevent_mail_process_overrun
1678 1689
 
1679 1690
     mark_completed "${FUNCNAME[0]}"
1680 1691
 }

+ 1
- 0
src/freedombone-upgrade View File

@@ -102,6 +102,7 @@ if [ -d "$PROJECT_DIR" ]; then
102 102
         email_disable_chunking
103 103
         rm /etc/exim4/exim4.conf.template.bak*
104 104
         email_update_onion_domain
105
+        prevent_mail_process_overrun
105 106
         #defrag_filesystem
106 107
 
107 108
         # reinstall tor from backports