[Dovecot] compression script for use with zlib module

Leonardo Rodrigues leolistas at solutti.com.br
Wed Sep 9 00:37:21 EEST 2009


    Hi,

    I'm wondering if someone already implemented a compression script 
(and would like to share it) based on the step-by-step provided on wiki 
page of Zlib module.

    I can already do some find|xargs gzip .... but couldnt implement it 
completly as described on the wiki page. I know the suggested 
step-by-step is very detailed and probably a must simplier will be 
enough for almost anyone .... anyway, if someone have the full script 
and would like to share it, i would be glad to get it :)


http://wiki.dovecot.org/Plugins/Zlib


1) Find the mails you want to compress in a single maildir.
2) Compress the mails to tmp/
    * Update the compressed files' mtimes to be the same as they were in 
the original files (e.g. touch command)
3) Run maildirlock <path> <timeout>. It writes PID to stdout, save it.
    * <path> is path to the Maildir's dovecot-uidlist (the control 
directory, if it's separate)
    * <timeout> specifies how long to wait for the lock before failing.
4) If maildirlock grabbed the lock successfully (exit code 0) you can 
continue.
5) For each mail you compressed:
   1. Verify that it still exists where you last saw it.
   2. If it doesn't exist, delete the compressed file. Its flags may 
have been changed or it may have been expunged. This happens rarely, so 
just let the next run handle it.
   3. If the file does exist, rename() (mv) the compressed file over the 
original file.
          * Dovecot can now read the file, but to avoid compressing it 
again on the next run, you'll probably want to rename it again to 
include e.g. a "Z" flag in the file name to mark that it was compressed 
(e.g. 1223212411.M907959P17184.host,S=3271:2,SZ). Remember that the 
Maildir specifications require that the flags are sorted by their ASCII 
value, although Dovecot itself doesn't care about that.
6) Unlock the maildir by sending a TERM signal to the maildirlock 
process (killing the PID it wrote to stdout).



-- 


	Atenciosamente / Sincerily,
	Leonardo Rodrigues
	Solutti Tecnologia
	http://www.solutti.com.br

	Minha armadilha de SPAM, NÃO mandem email
	gertrudes at solutti.com.br
	My SPAMTRAP, do not email it






More information about the dovecot mailing list