Quantcast
Channel: iRedMail
Viewing all articles
Browse latest Browse all 48092

Re: Amavis MySQL table cleanup/maintenence

$
0
0

Hi broth,

You can add this sql command in the file directly, or try below patch. Let me know whether it works for you or not.

diff -r 46eeed2e9cf8 tools/cleanup_amavisd_db.py
--- a/tools/cleanup_amavisd_db.py    Mon Jan 07 00:56:38 2013 +0800
+++ b/tools/cleanup_amavisd_db.py    Sat Jan 12 17:49:22 2013 +0800
@@ -98,6 +98,11 @@
         WHERE msgs.time_num < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL %d DAY))
         ''' % settings.AMAVISD_REMOVE_MAILLOG_IN_DAYS
     )
+    conn.query('''
+        DELETE FROM msgs
+        WHERE time_num < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL %d DAY))
+        ''' % settings.AMAVISD_REMOVE_MAILLOG_IN_DAYS
+    )
 elif sql_dbn == 'postgres':
     conn.query('''
         DELETE FROM msgrcpt
@@ -107,6 +112,11 @@
             AND msgs.time_iso < CURRENT_TIMESTAMP - INTERVAL '%d DAYS'
         ''' % settings.AMAVISD_REMOVE_MAILLOG_IN_DAYS
     )
+    conn.query('''
+        DELETE FROM msgs
+        WHERE time_iso < CURRENT_TIMESTAMP - INTERVAL '%d DAYS'
+        ''' % settings.AMAVISD_REMOVE_MAILLOG_IN_DAYS
+    )
 
 # delete unreferenced records from tables msgrcpt, quarantine and maddr
 logger.info('Delete unreferenced records from table msgrcpt.')

Viewing all articles
Browse latest Browse all 48092

Trending Articles