Article View: comp.mail.mush
Article #194Re: .mushrc && folders (was Help with auto-processing of messages?)
From: Scott Blachowicz
Date: Wed, 13 Sep 1989 14:21
Date: Wed, 13 Sep 1989 14:21
69 lines
3090 bytes
3090 bytes
>In article <10569@dasys1.UUCP> gts@dasys1.UUCP (G. T. Samson) writes:
>
> Hi there. I've finally figured out a proper way to use the
> "pick" command (from inside a script file), but for the life
> of me, I can't figure out how to get this script file to
> execute automatically!
>
> What I'm trying to do is to toss out certain mail, move other
> mail to separate mailboxes for later perusal, etc. - all the
> things that the "pick" command does best. Now, how do I get
> this to happen every time that mush starts up? I know that I
> shouldn't put it in the .mushrc file, as no messages have yet
> been read in when that's executed... but I even tried to bind
> the command that I want to run to a key, and it wouldn't let
> me pass an argument.
I've done the same sort of thing, but I don't have it run when I read
my mail. I run it as a "batch job" out of crontab. I setup a script
that cleans out my mail folder directory (archive old messages into an
"old/" directory and compress them; delete old messages out of
folders). The script looks like this (I imagine there are better ways
to do this, but this one has worked for a while, so I don't muck with
it):
---------------------
#! /bin/sh
#
# Usage: clean_mboxes [<folder_directory>]
#
cd ${1:-$HOME/mboxes}
if [ ! -d old ]
then mkdir old 2>/dev/null
fi
{
ls -F | # Generate mbox filenames
grep -v / | # Filter out directories (e.g. the old/ dir)
# Now, this generates the MUSH commands to delete messages from
# +backup that are > 3 months old and archive messages older than
# 4 months from other folders.
awk '
{
if ($1 == "backup") {
print "folder " $1 " | pick -ago -3m | delete";
}
else {
print "uncompress old/" $1;
print "folder " $1 " | pick -ago -4m | save old/" $1 " | delete";
print "compress -v old/" $1;
}
}
END {
print "quit";
}'
} >/tmp/cmb.$$ 2>&1
# Give all those commands to MUSH and filter out some of the messages.
/usr/local/bin/mush -i < /tmp/cmb.$$ 2>&1 |
sed -n '
/^Saved/p
/^Appended/p
/^Updating/p
/^"/p
/^old\//p
'
rm -f /tmp/cmb.$$
--
Scott Blachowicz E-mail: scott@grlab.UUCP
USPS: Graphicus ..or.. ...!hpubvwa!grlab!scott
150 Lake Str S, #206 VoicePh: 206/828-4691
Kirkland, WA 98033 FAX: 206/828-4236
Technical Details
Message-ID:
<SCOTT.89Sep13102128@grlab.grlab.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!apple!agate!shelby!unix!hplabs!hp-pcd!hplsla!hpubvwa!grlab!scottReferences:
<10569@dasys1.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!apple!agate!shelby!unix!hplabs!hp-pcd!hplsla!hpubvwa!grlab!scott From: scott@grlab.UUCP (Scott Blachowicz) Newsgroups: comp.mail.mush Subject: Re: .mushrc && folders (was Help with auto-processing of messages?) Message-ID: <SCOTT.89Sep13102128@grlab.grlab.UUCP> Date: 13 Sep 89 14:21:28 GMT References: <10569@dasys1.UUCP> Sender: news@grlab.UUCP Distribution: usa Organization: Graphicus, Inc., Kirkland, WA USA Lines: 69 In-reply-to: gts@dasys1.UUCP's message of 28 Aug 89 20:57:41 GMT