procmail
[Top] [All Lists]

Re: compression of mailboxes

1996-03-31 14:33:19
From: Chuck Campbell <campbell(_at_)Starbase(_dot_)NeoSoft(_dot_)COM>
How easy/hard might it be to set procmail up to use gzip to compress
messages for normal storage/use?

Quite easy.  I do it all the time.  Please see below.  (I think dattier
helped me with the first incarnation of this recipe, for which I am
grateful.)

I realise I need to modify elm to be able to read these as well.  Does
anyone know enough about the related programs (gzip and elm) to know
if this is a realistic expectation, especially before anyone explains
how to do this with procmail.

        :0 w:
        * ! ^(To|Cc): +dman
        * ^TOprocmail
        | gzip -fc >> procmail.gz


To read stuff, I have a handy-dandy little shell-script called "mget":

  1:19pm netcom3:~> cat ~/bin/mget
  #!/usr/bin/sh
  
  cd $HOME/Mail
  
  ( gzip -d $1* 2>/dev/null && Mail -f $1* ) || \
        ( gzip -d archive/$1* 2>/dev/null && Mail -f archive/$1* )
  
  gzmail        # recompresses anything uncompressed in $HOME/Mail/archive
  gzmail .      # recompresses anything uncompressed in $HOME/Mail
  
  
  # Ver. 2.4; Aug 10 1994
  # Script "mget" by Dallman Ross <dman(_at_)netcom(_dot_)com>



It is slightly more complicated than it needs to be, because of my habit
of keeping some mail in $HOME/Mail and other mail in $HOME/Mail/archive.
I wanted to be able to read any of them with one command.  This looks
first in the former and then in the latter, opening whichever one it
finds.

One bug which I haven't bothered to fix is that you cannot give the
entire name of the file you want to read -- stop at some point before
the last character (the script does file-completion), but when you have
achieved a unique string, or you get an error.  (You can have the
same-named file in both directories.  Default looks in $HOME/Mail first.
You can always prepend a different path to the script argument.)

Anticipated question: "What if mail arrives while I'm reading?"  When
you're done with mget and the mail folder you were reading gets
recompressed (if any is left), the new message will now be in there too.
One small disadvantage is that the new message will now be at the top of
the folder instead of the bottom.  But I live with that, not wanting to
bother to come up with a more convoluted system.  I've been using this
for about 1.5 years.

 
-- 
  __                               ___               dman(_at_)netcom(_dot_)com 
 (/ \  _   /) /) _ _ _  _    _    (/__) _   _   _    1 (510) 645-1883 
 /`  )(_(_( _(__/|/|/(_(_(_/| (   / (  (_)_/_)_/_)_  350 Perkins St., #108 
(___/                          ` (   \               Oakland, CA 94610-3422

<Prev in Thread] Current Thread [Next in Thread>