Hello,
My mail server is now up to date.
After running the script the database is still the same size.
msgs 121MB
quarantine 900MB
[root@mail tools]# python cleanup_amavisd_db.py
* [2013-09-05 17:18:56] Loading config file: /var/www/iRedAdmin-Pro-MySQL-1.7.0/tools/../settings.ini
* [2013-09-05 17:18:56] Backend: mysql
* [2013-09-05 17:18:56] Remove records of quarantined mails older than 7 days.
* [2013-09-05 17:18:56] Remove records of sent/received mails older than 7 days.
* [2013-09-05 17:18:56] Delete quarantined mails which older than 7 days
75.45 (1):
DELETE FROM msgs
WHERE
quar_type = 'Q'
AND time_num < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
* [2013-09-05 17:20:13] Delete incoming/outgoing emails which older than 7 days
* [2013-09-05 17:20:13] + Delete from table `msgrcpt`.
341.6 (2):
DELETE msgrcpt.*
FROM msgrcpt
INNER JOIN msgs ON msgrcpt.mail_id=msgs.mail_id
WHERE msgs.time_num < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
* [2013-09-05 17:25:55] + Delete from table `msgs`.
33684.16 (3):
DELETE FROM msgs
WHERE time_num < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
* [2013-09-06 02:47:20] Delete unreferenced records from table `msgrcpt`.
704.45 (4):
DELETE FROM msgrcpt
WHERE NOT EXISTS (SELECT 1 FROM msgs WHERE mail_id=msgrcpt.mail_id)
* [2013-09-06 02:59:04] Delete unreferenced records from table `quarantine`.
6586.28 (5):
DELETE FROM quarantine
WHERE NOT EXISTS (SELECT 1 FROM msgs WHERE mail_id=quarantine.mail_id)
* [2013-09-06 04:48:53] Delete unreferenced records from table `maddr`.
7200.59 (6):
DELETE FROM maddr
WHERE NOT EXISTS (SELECT 1 FROM msgs WHERE sid=id)
AND NOT EXISTS (SELECT 1 FROM msgrcpt WHERE rid=id)
Can i just delete the table contents in another program without any consequences?
Thx
Greets
Jef