Parcourir la source

Better email log handling

Bob Mottram il y a 6 ans
Parent
révision
77993fb229
1 fichiers modifiés avec 21 ajouts et 11 suppressions
  1. 21
    11
      src/freedombone-base-email

+ 21
- 11
src/freedombone-base-email Voir le fichier

@@ -1696,18 +1696,28 @@ function install_email {
1696 1696
 
1697 1697
 function remove_ip_addresses_from_email_logs {
1698 1698
     { echo '#!/bin/bash';
1699
-      echo 'if [ -f /var/log/exim4/mainlog ]; then';
1700
-      echo "    if grep -q '\\[' /var/log/exim4/mainlog; then";
1701
-      echo "        tail -n 50 /var/log/exim4/mainlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_mainlog";
1702
-      echo '        chown Debian-exim:adm /tmp/.exim4_mainlog';
1703
-      echo '        mv /tmp/.exim4_mainlog /var/log/exim4/mainlog';
1699
+      echo '';
1700
+      echo 'if grep -q "= /dev/null" /etc/php/7.0/fpm/php-fpm.conf; then';
1701
+      echo '    if [ -f /var/log/exim4/mainlog ]; then';
1702
+      echo '        rm /var/log/exim4/mainlog';
1704 1703
       echo '    fi';
1705
-      echo 'fi';
1706
-      echo 'if [ -f /var/log/exim4/rejectlog ]; then';
1707
-      echo "    if grep -q '\\[' /var/log/exim4/rejectlog; then";
1708
-      echo "        tail -n 50 /var/log/exim4/rejectlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_rejectlog";
1709
-      echo '        chown Debian-exim:adm /tmp/.exim4_rejectlog';
1710
-      echo '        mv /tmp/.exim4_rejectlog /var/log/exim4/rejectlog';
1704
+      echo '    if [ -f /var/log/exim4/rejectlog ]; then';
1705
+      echo '        rm /var/log/exim4/rejectlog';
1706
+      echo '    fi';
1707
+      echo 'else';
1708
+      echo '    if [ -f /var/log/exim4/mainlog ]; then';
1709
+      echo "        if grep -q '\\[' /var/log/exim4/mainlog; then";
1710
+      echo "            tail -n 50 /var/log/exim4/mainlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_mainlog";
1711
+      echo '            chown Debian-exim:adm /tmp/.exim4_mainlog';
1712
+      echo '            mv /tmp/.exim4_mainlog /var/log/exim4/mainlog';
1713
+      echo '        fi';
1714
+      echo '    fi';
1715
+      echo '    if [ -f /var/log/exim4/rejectlog ]; then';
1716
+      echo "        if grep -q '\\[' /var/log/exim4/rejectlog; then";
1717
+      echo "            tail -n 50 /var/log/exim4/rejectlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_rejectlog";
1718
+      echo '            chown Debian-exim:adm /tmp/.exim4_rejectlog';
1719
+      echo '            mv /tmp/.exim4_rejectlog /var/log/exim4/rejectlog';
1720
+      echo '        fi';
1711 1721
       echo '    fi';
1712 1722
       echo 'fi'; } > /usr/bin/exim_log_tidy
1713 1723
     chmod +x /usr/bin/exim_log_tidy