From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <6f208cfa2c6fb1aa9f90207ea5e94437@plan9.ucalgary.ca> To: 9fans@cse.psu.edu Subject: Re: [9fans] archive outgoing mail From: mirtchov@cpsc.ucalgary.ca In-Reply-To: <62bb0841a646c26e0e730e30a4288ff2@mteege.de> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Mon, 26 Jan 2004 12:17:39 -0700 Topicbox-Message-UUID: c15b3fec-eacc-11e9-9e20-41e7f4b1d025 the following archives outgoing mail daily, easy to modify for monthly archival: % cat /mail/box/andrey/pipefrom #!/bin/rc rfork e ramfs TMP=/tmp/pipefrom.$pid datum=`{mdate} fileto=/mail/box/$user/sent/$datum test -e $fileto || {touch $fileto; chmod +a $fileto} cat > $TMP cat $TMP >> $fileto echo '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' >> $fileto # collect upas/send options options=() while (! ~ $#* 0 && ~ $1 -*) { options=($options $1); shift } # collect addresses and add them to my patterns dests=() while (! ~ $#* 0) { dests=($dests $1); shift } # send mail upas/send $options $dests < $TMP % you need to mkdir /mail/box/$user/sent for this to work... mdate is a very simple program that prints the date in a format that's easily sortable: % cat $home/src/cmd/mdate.c #include #include void main(int argc, char *argv[]) { Tm *t; USED(argc, argv); t = localtime(time(0)); print("%4.4d-%2.2d-%2.2d", t->year+1900, t->mon+1, t->mday); exits(0); } % one problem with this scheme -- the you can't use upas/fs on the sorted emails (they have different format than the one in your inbox). I haven't bothered to fix it, though a bit of sed-ing would suffice.