Re[2]: External mail attachments storage cleanup

2016-06-30 Thread Николай Мананков

Yes "dovecot purge" is certainly my mistake in the script but it really works 
completely analogous "doveadm purge" probably why I did not notice  the 
difference
before :)

It looks like it just launches the doveadm in this case.
Adding slashes after asterisks  unfortunately they also adds to the variable 
and the script gives an error like "doveadm(user/@example.org/): Error: User 
doesn't exist"
Thanks for the idea , I think it will be now more correctly :

===
#!/bin/sh

cd /backup/MailRoot/dovecot/domains  || exit 1

for i in *
  do
   if [ -d $i ]; then
  cd $i
    for j in *
 do
    if [ -d $j ]; then
    dovecot purge -u $j@$i
    fi
 done
   cd ..
   fi
  done

===


>Четверг, 30 июня 2016, 13:53 +03:00 от Alexander Moisseev 
>:
>
>On 30.06.16 12:51, Николай Мананков wrote:
>> -screenshot begin-
>>
>> mail:/etc/cron.daily # cat ./dovepurge.sh
>> #!/bin/sh
>>
>> cd /MailRoot/dovecot/domains
>>
>> for i in *
>>   do
>>cd $i
>> for j in *; do dovecot purge -u $j@$i; done
>>cd ..
>> done
>>
>> -screenshot end -
>>
>It might be worth to add slashes after asterisks to process only directories.
>Does "dovecot purge" actually work?
>
>-screenshot begin-
>
>#!/bin/sh
>
>cd /MailRoot/dovecot/domains || exit 1
>
>for i in */
>   do
>cd $i
> for j in */; do doveadm purge -u $j@$i; done
>cd ..
>done
>
>-screenshot end -
>
>> It is strange that the daemon does not do this automatically, and even 
>> setting up autoexpunge option does not help. Also IMHO certainly evident 
>> mistake in the documentation about the wildcards processing by purge 
>> command..
>
>I don't know how the developers themselves use Dovecot, but it lacks some 
>obvious features like automatic purge or SIS cleanup on mailbox deletion.
>



Re[2]: External mail attachments storage cleanup

2016-06-30 Thread Николай Мананков

  Yes "dovecot purge" is certainly my mistake in the script but it really works 
completely analogous "doveadm purge" probably why I did not notice  the 
difference
before :)

It looks like it just launches the doveadm in this case.
Adding slashes after asterisks  unfortunately they also adds to the variable 
and the script gives an error like "doveadm(user/@example.org/): Error: User 
doesn't exist"
Thanks for the idea , I think it will be now more correctly :

===
#!/bin/sh

cd /backup/MailRoot/dovecot/domains  || exit 1

for i in *
  do
   if [ -d $i ]; then
  cd $i
    for j in *
 do
    if [ -d $j ]; then
    dovecot purge -u $j@$i
    fi
 done
   cd ..
   fi
  done

===




>Четверг, 30 июня 2016, 13:53 +03:00 от Alexander Moisseev 
>:
>
>On 30.06.16 12:51, Николай Мананков wrote:
>> -screenshot begin-
>>
>> mail:/etc/cron.daily # cat ./dovepurge.sh
>> #!/bin/sh
>>
>> cd /MailRoot/dovecot/domains
>>
>> for i in *
>>   do
>>cd $i
>> for j in *; do dovecot purge -u $j@$i; done
>>cd ..
>> done
>>
>> -screenshot end -
>>
>It might be worth to add slashes after asterisks to process only directories.
>Does "dovecot purge" actually work?
>
>-screenshot begin-
>
>#!/bin/sh
>
>cd /MailRoot/dovecot/domains || exit 1
>
>for i in */
>   do
>cd $i
> for j in */; do doveadm purge -u $j@$i; done
>cd ..
>done
>
>-screenshot end -
>
>> It is strange that the daemon does not do this automatically, and even 
>> setting up autoexpunge option does not help. Also IMHO certainly evident 
>> mistake in the documentation about the wildcards processing by purge 
>> command..
>
>I don't know how the developers themselves use Dovecot, but it lacks some 
>obvious features like automatic purge or SIS cleanup on mailbox deletion.
>



Re[2]: External mail attachments storage cleanup

2016-06-30 Thread Николай Мананков

Thank you very much for your help! My mail  users are stored in the SQL base,  
therefore, using the fact that the my dovecot mailbox  folder names correspond 
to the names of mail users in the domain , I wrote a simple scrpt  and just 
threw it in a "/etc/cron.daily" folder.

-screenshot begin-

mail:/etc/cron.daily # cat ./dovepurge.sh
#!/bin/sh

cd /MailRoot/dovecot/domains

for i in *
  do
   cd $i
    for j in *; do dovecot purge -u $j@$i; done
   cd ..
done

-screenshot end -

It is strange that the daemon does not do this automatically , and even setting 
up autoexpunge option does not help. A lso IMHO  certainly evident mistake in 
the documentation about the wildcards processing by purge command..

Re: External mail attachments storage cleanup

2016-06-29 Thread Alexander Moisseev

On 29.06.2016 13:06, Николай Мананков wrote:

 Hi!

Thanks it worked! But only when I have a specific user instead wldcard (i mean 
-u *@example.org).  Now I think I need to write a script that searches for 
users in the domain , and starts each of them this command . And apparently it 
is necessary to add to the cron job..



Hi,

The script:
doveadm-expunge - iterates over passwd-file databases, expunges messages in 
Junk and Trash folders and purges mailboxes for every user.
https://github.com/moisseev/doveadm-tools/blob/master/bin/doveadm-expunge

The crontab entry:
5   4   *   *   *   /usr/local/bin/doveadm-expunge


External mail attachments storage cleanup

2016-06-29 Thread Николай Мананков
 Hi!

Thanks it worked! But only when I have a specific user instead wldcard (i mean 
-u *@example.org).  Now I think I need to write a script that searches for 
users in the domain , and starts each of them this command . And apparently it 
is necessary to add to the cron job..


Re: External mail attachments storage cleanup

2016-06-28 Thread Timo Sirainen
On 27 Jun 2016, at 16:11, Николай Мананков  wrote:
> 
> Hi,
> 
> I have set up mdbox backend witch saving mail attachments to external files 
> option. Dovecot store attachments to external files but never delete them.

You haven't run doveadm purge?


External mail attachments storage cleanup

2016-06-27 Thread Николай Мананков
 Hi,

I have set up mdbox backend witch saving mail attachments to external files 
option. Dovecot store attachments to external files but never delete them.

Why?