Thu 97-12-11 Liston Bias <bias(_at_)pobox(_dot_)com> list.procmail
| From: Liston Bias <bias(_at_)pobox(_dot_)com>
| Subject: Long Headers and Backup
|
| Additionally, Any ideas on how to make this saving of only last 200
| messages in INBOX more efficient? The only down side to this method is
| that everything is always viewed as NEW, but that is not important for my
| purposes.
The recipe is okay, the only dowside is that it is run every time
message arrives. This may not be a problem if you receive only
few messages.
I have accomplished the backup so that:
- Write incoming files to backup mbox (MH styled individual messages)
- Clean the backup only once a day and save N newest messages.
The cleaning is accomplished with my procmail cron module that activates
only once a day. The module is a plug-in, so you can put all your
daily tasks there. Get it with:
to: jari(_dot_)aalto(_at_)poboxes(_dot_)com
Subject: send pm-code.shar
jari
[pm-jacron.rc exerpt]
Usage example
Save backups to separate directory, but do cleaning only once a day
We do not keep backups from mailing list messages
LISTS = "(procmail|list-1|list-2)"
BACKUP_DIR = "$HOME/Mail/backup/."
# Store backups: separate files to directory
:0 c:
*$ ! $LISTS
$BACKUP_DIR
# Run this file once a day. It contains all my
# cron tasks
#
CRON_RC = $PMSRC/pm-jacron.rc # the framework
JA_CRON_RC = $PMSRC/pm-mycron.rc # the tasks to do
JA_CRON_RUN_FLAG = $HOME/.cron-running # define this!
# Do not enter here if message arrived at the same day when
# the cron is already running. The JA_CRON_RC takes care
# of deleting the file
#
:0
*$ ! ? test -f $JA_CRON_RUN_FLAG
{ INCLUDERC = $CRON_RC }
The *pm-mycron.rc* file may contain anything. For example to clean
the backup directory; you add these statements there
# rm dummy: if ls doesn't return files, make sure rm has
# at least one argument.
# ls -t: list files newwest first
# sed: chop $max newest files from the listing, leaving the
# old ones
max = 32
:0 hwic
| cd $BACKUP_DIR && rm -f dummy s -t msg.* | sed -e 1,${max}d