"Mike A. Harris" <mharris(_at_)opensourceadvocate(_dot_)org> writes:
Yes, I've got the backup recipe in my .procmailrc, however it
only backs up like 32 messages. I am on about 80+ mailing lists
and mail downloads almost constantly. This means that it backs
up about 2 minutes worth of email messages. Not very useful
really. No idea how to make it back up a useful amount of
messages - 1000+ or so.
Err .. Mike, one would expect you'd be able to adjust it to your needs.
The handiest way to do this I've found works like this:
You write the backups in MH style files. (One file per message),
which makes the rest easier.
To induce procmail to write that way you just give an address like
`backup/.' The dot does the work. (assuming your procmailrc already
sets $MAILDIR) You must create `backup' by hand. mkdir $MAILDIR/backup
My recipe (first on the list) looks like this:
:0 c
backup/.
All incoming messages are written there in one file per message with
numbered file names.
Now the fun part, but first I think it is not a good idea to tie the
following trim script to the procmailrc recipe, because it would be
run with every message. IE several hundred times per day.
So in a separate script:
cat /bin/trim-bs
#!/bin/sh
rm `ls -t /home/reader/spool/backup/[0-9]* | sed -e 1,1000d` 2> /dev/null
I just run `trim-bs' by hand when I feel like it but of course it can
be run by cron. Because `ls' is run with `-t', the most recent
messages are at the top of the list. Sed removes the first 1000 from
the deletion list. Meaning I always have duplicates of at least the
1000 most recent messages.
The /dev/null is there because until you accumulate the 1000 the `rm'
command will throw some output to stderr.
One note here: If you let the number go much above 3,000 or so you'll
need to add in some `xargs' provision, because trim-bs will start to
give the `too many args' error.
I started this method after accidently leveling ~/ with a rogue
`rm -rf' command. All that was left were the dot files. he he
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail