procmail
[Top] [All Lists]

Re: gziping

1997-05-29 12:49:00
At 05:34 PM 5/28/97 +0200, Lupus Yonderboy wrote:
Im using the following recipe (from man page):

# Create a backup cache of 30 most recent messages in case of mistakes
:0 c
$HOME/Mail/backup
:0 ic
| cd $HOME/Mail/backup && rm -f dummy `ls -t msg.* | sed -e 1,30d`

It's OK, but I'd like to have gziped messages in backup directory.

Untested, but how about:

:0 c: backup.lock
    {
    :0 c
    $HOME/Mail/backup
    :0 ic
    cd $HOME/Mail/backup && gzip `ls -t msg.* | head -1` && \
        rm -f dummy `ls -t msg.* | sed -e 1,30d`
    }

I'm not exactly sure about the locking here... you now need it
in case two messages arrive at once to avoid having one message
not gzipped and the other gzipped twice (possibly making a mess).
I'm not sure one can lock a nested recipe pair like that.  I'm also not
sure whether that "c" flag should be on the last recipe in the {}'s.

Cheers,
Stan

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