1

Topic: python /opt/www/iredadmin/tools/cleanup_amavisd_db.py 錯誤訊息

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? download
- Linux/BSD distribution name and version: CentOS7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? LDAP-3.6
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi 版主:
昨天更新為 : iRedAdmin-Pro-LDAP-3.6

今早出現此錯誤訊息:

Cron <root@mail> python /opt/www/iredadmin/tools/cleanup_amavisd_db.py >/dev/null

Traceback (most recent call last):
  File "/opt/www/iredadmin/tools/cleanup_amavisd_db.py", line 55, in <module>
    db_settings = iredutils.get_settings_from_db(params=['amavisd_remove_quarantined_in_days', 'amavisd_remove_maillog_in_days'])
  File "/opt/www/iredadmin/tools/../libs/iredutils.py", line 995, in get_settings_from_db
    conn = web.admindb
AttributeError: 'module' object has no attribute 'admindb'

PS: last login 功能正常

Thanks.

2

Re: python /opt/www/iredadmin/tools/cleanup_amavisd_db.py 錯誤訊息

是个 bug,这里是 patch。

diff -r 86a71c86211c tools/cleanup_amavisd_db.py
--- a/tools/cleanup_amavisd_db.py    Mon Apr 29 13:28:33 2019 +0800
+++ b/tools/cleanup_amavisd_db.py    Mon Apr 29 15:02:20 2019 +0800
@@ -52,7 +52,9 @@
 logger.info('Backend: %s' % backend)
 logger.info('SQL server: %s:%d' % (settings.amavisd_db_host, int(settings.amavisd_db_port)))
 
-db_settings = iredutils.get_settings_from_db(params=['amavisd_remove_quarantined_in_days', 'amavisd_remove_maillog_in_days'])
+conn_iredadmin = ira_tool_lib.get_db_conn('iredadmin')
+db_settings = iredutils.get_settings_from_db(params=['amavisd_remove_quarantined_in_days', 'amavisd_remove_maillog_in_days'],
+                                             conn=conn_iredadmin)
 keep_quar_days = db_settings['amavisd_remove_quarantined_in_days']
 keep_inout_days = db_settings['amavisd_remove_maillog_in_days']
 query_size_limit = settings.AMAVISD_CLEANUP_QUERY_SIZE_LIMIT

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: python /opt/www/iredadmin/tools/cleanup_amavisd_db.py 錯誤訊息

Hi 版主:
上了 patch 後
# python /opt/www/iredadmin/tools/cleanup_amavisd_db.py
* Backend: ldap
* SQL server: 127.0.0.1:3306
* Enable dirty read for querying without locking SQL tables.
* Delete quarantined mails which older than 45 days
* Delete incoming/outgoing emails which older than 45 days
* Delete unreferenced records from table `msgrcpt`.
* Delete unreferenced records from table `quarantine`.
* Delete unreferenced records from table `maddr`.
* Delete unreferenced records from table `mailaddr`.
*
* Remained records:
*
*       `msgs`: 1683
* `quarantine`:
*      `maddr`: 376
*   `mailaddr`:

此應該可以了.

Thanks.