On 01/09/2013 08:37 AM, Gedalya wrote:
On 01/09/2013 02:32 AM, Robert Schetterer wrote:
my daily cron job says:
#!/bin/sh doveadm expunge -A mailbox Junk savedbefore 14d doveadm expunge -A mailbox Trash savedbefore 30d doveadm expunge -A mailbox "Trash.*" savedbefore 30d
do verbose logging during cron
Best Regards MfG Robert Schetterer No need, I have indeed already gone beyond the "but I made a cron job, why isn't it working" point.
mysql> select * from expires; . . . 7 rows in set (0.00 sec)
Complete doveadm output with domain masked:
# doveadm -D search -A mailbox Trash savedbefore 14d doveadm(root): Debug: Loading modules from directory: /usr/lib/dovecot/modules doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/lib10_quota_plugin.so doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/lib20_expire_plugin.so doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/lib20_listescape_plugin.so doveadm(root): Debug: Loading modules from directory: /usr/lib/dovecot/modules/doveadm doveadm(root): Debug: Skipping module doveadm_acl_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_acl_plugin.so: undefined symbol: acl_user_module (this is usually intentional, so just ignore this message) doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_expire_plugin.so doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_quota_plugin.so doveadm(root): Debug: Skipping module doveadm_zlib_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_zlib_plugin.so: undefined symbol: i_stream_create_deflate (this is usually intentional, so just ignore this message) doveadm(root): Debug: Skipping module doveadm_fts_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol: fts_list_backend (this is usually intentional, so just ignore this message) doveadm(root): Debug: expire: Searching only users listed in expire database doveadm(root): Debug: expire: Stopping iteration on key shared/expire/jedi1@xxxxxx.com/Trash (1357165578 > 1356528524)
mysql> select * from expires; . . . 6 rows in set (0.00 sec)
The row being deleted: levy@xxxxxxx.com, Junk, 1350397036 (Tue Oct 16 10:17:16 EDT 2012), all others at this point in time are younger than 14 days. So far it has seemed to me that running any search or expunge has the sole effect of deleting rows matching the savedbefore criteria, regardless of the mailbox criteria.
working with doveadm -o"mail_plugins=....." leaving out expire seems to work fine.
I got it working. I know this worked before, I can't specify when it stopped working, but here is the story.
I have: auth_default_realm = domain.com
in dovecot-sql.conf.ext I had: iterate_query = SELECT userid as user, domain FROM email where deleted=0
Now it's working when I changed it to: iterate_query = SELECT concat(userid, '@', domain) as username FROM email where deleted=0
I noticed this when running doveadm expunge (without expire plugin) and saw lines like the following: doveadm(jeremy): Info: User no longer exists, skipping
This user exists, but on another domain, not the default one.
Users under the default domain come up as normal: doveadm(hr): Debug: Added userdb setting: mail=maildir:/stor/mail/domains/domain.com/hr/hr/Maildir
After changing iterate query all users come up as fully qualified, like doveadm(jeremy@otherdomain.com): Debug: Added userdb setting: mail=maildir:/stor/mail/domains/otherdomain.com/je/jeremy/Maildir
So, with regards to the expires issue, I guess the reason why the expires table wasn't working is because it contains the full email address in the username field and doveadm here was working with the userid alone.
Is this a bug? The wiki clearly says that iterate_query can take the domain in a separate field, yet dovecot seems to ignore the domain field and use auth_default_realm.
Thanks,
Gedalya