Re: archiving mailboxes each month
On Aug/23/1999, Gerald Oskoboiny wrote: > Oops! This is what I'm using: > mailboxes `echo ~/mail/* | fmt -1 | grep -v /outbox$ | fmt -` > Using echo instead of find assumes that everything in ~/mail is a > mailbox (no subdirectories within it), which it is for me. Well, as I told in the reply to Jan, his fix worked fine, so that's what I'm using now :-) Thanks anyway :-) BTW, I didn't know about fmt :-m One more trick to the trickbag :-) -- Roberto Suarez Soto | Mountain of iron, gate of steel, mailto:[EMAIL PROTECTED]| Tower of adamant, he saw it: * Corgo - Lugo - Galicia - Spain |Barad-dur, Fortress of Sauron.
Re: archiving mailboxes each month
On Aug/22/1999, Jan Peter Hecking wrote: > Now you're missing an newline at the end of the string. Try > > mailboxes `find $HOME/mail -type f -print | tr '\n' ' ';echo` > > instead. Beware also that the tilde ~ doesn't get expanded - you > have to use $HOME instead. Yep, you're right. It works perfectly now, thanks :-) -- Roberto Suarez Soto | Wrap the Internet around every brain mailto:[EMAIL PROTECTED]| on the planet and spin the planet. * Corgo - Lugo - Galicia - Spain | Software flows in the wires.
Re: archiving mailboxes each month
On Sun, Aug 22, 1999 at 12:08:42PM +0200, Jan Peter Hecking wrote: > On Fri, Aug 20, 1999 at 01:37:30PM +0200, Roberto Suarez Soto wrote: > > mailboxes `find ~/mail -type f -print | tr '\n' ' '` : > Now you're missing an newline at the end of the string. Try > > mailboxes `find $HOME/mail -type f -print | tr '\n' ' ';echo` > > instead. Beware also that the tilde ~ doesn't get expanded - you > have to use $HOME instead. I guess this depends on your shell -- ~ works for me (using bash.) -- Gerald Oskoboiny <[EMAIL PROTECTED]> http://impressive.net/people/gerald/
Re: archiving mailboxes each month
On Fri, Aug 20, 1999 at 01:27:27PM +0200, Roberto Suarez Soto wrote: > On Aug/19/1999, Gerald Oskoboiny wrote: > > You can get around this by using: > > mailboxes `find ~/mail -type f -print` > > Doesn't work here :-) Mutt only treats as mailbox the first item in > the list. So, if ~/mail had the folders "folder1", "folder2", "folder3", the > above command would just list "folder1" as a mailbox. > > And I don't know how to fix it, if you were wondering O:-) What's > the similar thing that you say you use? Oops! This is what I'm using: mailboxes `echo ~/mail/* | fmt -1 | grep -v /outbox$ | fmt -` Using echo instead of find assumes that everything in ~/mail is a mailbox (no subdirectories within it), which it is for me. I use the fmt -1 to put each mailbox on a single line so I can grep -v for /outbox$ , then fmt - to put them all back on a single line afterwards. So if you use this instead: mailboxes `find ~/mail -type f -print | fmt -` it should work. (or the tr ... echo solution already posted should work fine, too.) Note that this fmt - will break if the total bytecount of the names of your mailboxes is greater than . I initially tried using something larger like 9 but found that the fmt from gnu textutils v1.22 is broken: devo: gerald> echo asdf | fmt -9 [ no output ] devo: gerald> fmt --version fmt (GNU textutils) 1.22 (hmm, I see there's a new textutils available now, they might've fixed this in the meantime: ftp://prep.ai.mit.edu/pub/gnu/textutils/textutils-2.0.tar.gz ) -- Gerald Oskoboiny <[EMAIL PROTECTED]> http://impressive.net/people/gerald/
Re: archiving mailboxes each month
On Fri, Aug 20, 1999 at 01:37:30PM +0200, Roberto Suarez Soto wrote: > mailboxes `find ~/mail -type f -print | tr '\n' ' '` > > It looks right, isn't it? > > It doesn't work either O:-) And I really don't know what's the fault > now. When I put this line in my muttrc, and then I type "mutt -y", mutt just > exits without doing anything :-? But if I redirect the result of that > command to a file, and then paste its contents as a "mailboxes" line, works > fine :-? Now you're missing an newline at the end of the string. Try mailboxes `find $HOME/mail -type f -print | tr '\n' ' ';echo` instead. Beware also that the tilde ~ doesn't get expanded - you have to use $HOME instead. bye, Jan -- Jan Peter Hecking - University of Rostock - Dept. of Computer Science eMail: [EMAIL PROTECTED] (icq #14643959) /\/\ public key: http://www.informatik.uni-rostock.de/~jhecking/pgp \--/ fingerprint: 18 91 55 54 62 67 CC 71 05 5F C7 AE E4 F3 B7 D9 \/
Re: archiving mailboxes each month
On Aug/19/1999, Gerald Oskoboiny wrote: > You can get around this by using: > > mailboxes `find ~/mail -type f -print` Doesn't work here :-) Mutt only treats as mailbox the first item in the list. So, if ~/mail had the folders "folder1", "folder2", "folder3", the above command would just list "folder1" as a mailbox. And I don't know how to fix it, if you were wondering O:-) What's the similar thing that you say you use? -- Roberto Suarez Soto | Clean my wounds mailto:[EMAIL PROTECTED]| Wash away all fear * Corgo - Lugo - Galicia - Spain | Let courage be mine
Re: archiving mailboxes each month
Yes, I'm replying again :-) I have realized just now, and the prior message has already been sent. Consider this just a fix :-) On Aug/19/1999, Gerald Oskoboiny wrote: > You can get around this by using: > mailboxes `find ~/mail -type f -print` > (untested, but I use something similar.) As I said before, this doesn't work, it just considers the first item as a mailbox; which happens to be logic, because "find" puts the result as a column of items. Then, we just have to do this to make it work: mailboxes `find ~/mail -type f -print | tr '\n' ' '` It looks right, isn't it? It doesn't work either O:-) And I really don't know what's the fault now. When I put this line in my muttrc, and then I type "mutt -y", mutt just exits without doing anything :-? But if I redirect the result of that command to a file, and then paste its contents as a "mailboxes" line, works fine :-? My excuses for the excessive noise :-) -- Roberto Suarez Soto | Clean my wounds mailto:[EMAIL PROTECTED]| Wash away all fear * Corgo - Lugo - Galicia - Spain | Let courage be mine
Re: archiving mailboxes each month
Gerald Oskoboiny ([EMAIL PROTECTED]) wrote: > On Thu, Aug 19, 1999 at 04:03:52AM -0230, Chris Gushue wrote: > > I guess I should paste basically what I am now doing with procmail. > > > > ## ~/.procmailrc > > looks good... > > > :0: > > * > > 0inbox > > The "*" line here isn't needed; if there are no "*" lines > procmail applies the rule. > I wasn't aware of that, but I haven't been messing with procmail for all that long. > > ## end of ~/.procmailrc > > > > With this being my folder list for mutt: > > > > ## ~/.mutt/folders > > # Mail folders > > set folder=~/mail > > set spoolfile=+0inbox > > # Dated mailboxes > > mailboxes +1999-08/debian-user > > mailboxes +1999-08/linux-kernel > > mailboxes +1999-08/mutt-users > > > > Plus all of my other lists and procmail recipes. The only "bad" thing > > about this is that I have to manually add some new mailbox entries each > > month in my mutt rc file, but I think I can handle that :) > > You can get around this by using: > > mailboxes `find ~/mail -type f -print` > > (untested, but I use something similar.) That didn't work for me, Mutt flashed some error message while starting up, but it went too fast for me to see what it was. It might have had "regexp" in there somewhere (after thinking about this, it might be because of the ~ character. Using an absolute path might work fine). Anyway, I don't think I'll want to list *all* of my mail folders. Using a 800x600 frame buffer console, I get a 100x37 screen, and I like to have most of my mailboxes listed on the first screen if possible. My current plans are to possibly make directories such as 1999/08 and 1999/09 as my mail accumulates. So I will just have Mutt display 1999/08/ and 1999/09/, and eventually 1999/ and 2000/, when there are enough folders. So something like: mailboxes +1999/08 mailboxes +1999/09 mailboxes +1999-10/debian-user mailboxes +1999-10/linux-kernel mailboxes +1999-10/mutt-users and in February: mailboxes +1999 mailboxes +2000/01 mailboxes +2000-02/debian-user mailboxes +2000-02/linux-kernel mailboxes +2000-02/mutt-users That way, only the current month's mailboxes are shown, but I can still easily access the older stuff - the "hard" way would probably just involve an extra keypress :) > Note that most other mailers I've used can't even think about > doing stuff like this. :) You're definitely right about that :) > > Thanks again to everyone that helped. > > No problem! -- -- Chris Gushue -- [EMAIL PROTECTED] -- GCS d- s+:- a23 C++>$ UL+++ P+>++ L+++ E W++ N++ o-- K- w--- O- M-- V- PS+++ PE Y+ PGP++ t++ 5+ X++ R- tv+ b++ DI+ D+ G++ e h! r y+ -- http://seymour.napalm.net --- http://owirc.napalm.net -- PGP signature
Re: archiving mailboxes each month
On Wed, Aug 18, 1999 at 09:35:20PM -0230, Chris Gushue wrote: > Is there a way to archive mailboxes at the beginning of every month (or > some other period) like Pine does? Just after a couple weeks, my > debian-user mailbox (mbox) is 3.6 MB with over 1200 messages. As the > mailbox gets bigger, Mutt takes longer to open it. > > Eg. move the contents of debian-user to debian-user-1999-aug > > Any solution would be great, not necessarily a mutt-specific one > (eg. procmail/crontab/scripts/etc). I'm sure I saw a message about this > on a mailing list I am on, but couldn't find anything. Perhaps it was on > a newsgroup somewhere... Heh, here's another one: #!/bin/sh LISTDIR=$HOME/.mail/Lists ARCHIVEDIR=$HOME/.mail/Archives DATEDIR="${ARCHIVEDIR}/`date +%m-%d-%Y`" umask 077 if [ -d ${LISTDIR} ]; then mkdir -p ${DATEDIR} for i in ${LISTDIR}/* do mv $i ${DATEDIR} done fi Then I have a crontab like this: 15 05 * * 2,5 $HOME/bin/cron-mail -- BJ Goodwin <[EMAIL PROTECTED]> C85E 4F1C 34D4 8272 DED9 471A D427 EB20 54B0 35D1 Key ID: 54B035D1 PGP signature
Re: archiving mailboxes each month
On Thu, Aug 19, 1999 at 04:03:52AM -0230, Chris Gushue wrote: > I guess I should paste basically what I am now doing with procmail. > > ## ~/.procmailrc looks good... > :0: > * > 0inbox The "*" line here isn't needed; if there are no "*" lines procmail applies the rule. > ## end of ~/.procmailrc > > With this being my folder list for mutt: > > ## ~/.mutt/folders > # Mail folders > set folder=~/mail > set spoolfile=+0inbox > # Dated mailboxes > mailboxes +1999-08/debian-user > mailboxes +1999-08/linux-kernel > mailboxes +1999-08/mutt-users > > Plus all of my other lists and procmail recipes. The only "bad" thing > about this is that I have to manually add some new mailbox entries each > month in my mutt rc file, but I think I can handle that :) You can get around this by using: mailboxes `find ~/mail -type f -print` (untested, but I use something similar.) Note that most other mailers I've used can't even think about doing stuff like this. :) > Thanks again to everyone that helped. No problem! -- Gerald Oskoboiny <[EMAIL PROTECTED]> http://impressive.net/people/gerald/
Re: archiving mailboxes each month
I guess I should paste basically what I am now doing with procmail. ## ~/.procmailrc MAILDIR=/home/seymour/mail LOGFILE=/home/seymour/logs/procmail TODAY=`date +%Y-%m` :0 ic * ? test ! -d $TODAY | mkdir -p $TODAY && chmod 0700 $TODAY # - sort high traffic lists into monthly sections - :0: * ^Sender: .*[EMAIL PROTECTED] $TODAY/mutt-users :0: * ^Sender: .*[EMAIL PROTECTED] $TODAY/linux-kernel :0: * ^X-Mailing-List: .*[EMAIL PROTECTED] $TODAY/debian-user # - end high traffic folder list - :0: * 0inbox ## end of ~/.procmailrc With this being my folder list for mutt: ## ~/.mutt/folders # Mail folders set folder=~/mail set spoolfile=+0inbox # Dated mailboxes mailboxes +1999-08/debian-user mailboxes +1999-08/linux-kernel mailboxes +1999-08/mutt-users Plus all of my other lists and procmail recipes. The only "bad" thing about this is that I have to manually add some new mailbox entries each month in my mutt rc file, but I think I can handle that :) Note that I am using 0inbox as my spoolfile so that it will always be on top of the mailbox list. After a while, there will be a lot of dated folders listed, so then I could probably make ~/mail/0oldmail/ and move old mailboxes in there, with just "mailboxes +0oldmail" in my mutt settings. This way, my mailboxes won't get too big, nor will my mailbox list become too cluttered. Thanks again to everyone that helped. -- -- Chris Gushue -- [EMAIL PROTECTED] -- GCS d- s+:- a23 C++>$ UL+++ P+>++ L+++ E W++ N++ o-- K- w--- O- M-- V- PS+++ PE Y+ PGP++ t++ 5+ X++ R- tv+ b++ DI+ D+ G++ e h! r y+ -- http://seymour.napalm.net --- http://owirc.napalm.net -- PGP signature
Re: archiving mailboxes each month
Gerald Oskoboiny ([EMAIL PROTECTED]) wrote: > On Wed, Aug 18, 1999 at 09:35:20PM -0230, Chris Gushue wrote: > > Is there a way to archive mailboxes at the beginning of every month (or > > some other period) like Pine does? Just after a couple weeks, my > > debian-user mailbox (mbox) is 3.6 MB with over 1200 messages. As the > > mailbox gets bigger, Mutt takes longer to open it. > > > > Eg. move the contents of debian-user to debian-user-1999-aug > > > > Any solution would be great, not necessarily a mutt-specific one > > (eg. procmail/crontab/scripts/etc). I'm sure I saw a message about this > > on a mailing list I am on, but couldn't find anything. Perhaps it was on > > a newsgroup somewhere... > > A few years ago I started archiving an extra copy of all my incoming > email as it's received (with procmail), and find it really nice > to be able to hit "d" or ^d when reading mail without worrying > about losing something important. > [snip excellent procmail info] > > I recommend using filenames like -mm instead of 1999-aug > because they appear in date-order when sorted alphabetically. > (like in the output of ls.) Normally I would have realized this, but it was early for me :) I think this is mostly the solution I am looking for, though the other solutions posted on the list (logrotate and that perl script) also seem like they will work well. But too complicated for me (to set up, that is - I understand them). Although, I think I might make directories such as 1999-08/ and deposit a copy of the email in there with the regular mailbox name. At the moment I have 39 mailboxes, and having 5 or 6 new ones appear each month won't be any better :) I'm hoping for Mutt to be able to display the mailbox list in columns like Pine can/does (this has also been mentioned on this list not long ago). Thanks everyone for all the great replies. Mutt rules and this list is cool :) -- -- Chris Gushue -- [EMAIL PROTECTED] -- GCS d- s+:- a23 C++>$ UL+++ P+>++ L+++ E W++ N++ o-- K- w--- O- M-- V- PS+++ PE Y+ PGP++ t++ 5+ X++ R- tv+ b++ DI+ D+ G++ e h! r y+ -- http://seymour.napalm.net --- http://owirc.napalm.net -- PGP signature
Re: archiving mailboxes each month
On Wed, Aug 18, 1999 at 09:35:20PM -0230, Chris Gushue wrote: > Is there a way to archive mailboxes at the beginning of every month (or > some other period) like Pine does? Just after a couple weeks, my > debian-user mailbox (mbox) is 3.6 MB with over 1200 messages. As the > mailbox gets bigger, Mutt takes longer to open it. > > Eg. move the contents of debian-user to debian-user-1999-aug > > Any solution would be great, not necessarily a mutt-specific one > (eg. procmail/crontab/scripts/etc). I'm sure I saw a message about this > on a mailing list I am on, but couldn't find anything. Perhaps it was on > a newsgroup somewhere... A few years ago I started archiving an extra copy of all my incoming email as it's received (with procmail), and find it really nice to be able to hit "d" or ^d when reading mail without worrying about losing something important. I use something like this in my .procmailrc: ARCHIVEDIR=$HOME TODAY=`date +%Y/%m/%d` # make today's archive directory if it doesn't already exist :0 ic * ? test ! -d $ARCHIVEDIR/$TODAY | mkdir -p $ARCHIVEDIR/$TODAY && chmod 0755 $ARCHIVEDIR/$TODAY # archive everything :0c: $ARCHIVEDIR/$TODAY/. The "/." at the end of the last line says to use an MH-like format for storing the messages (one message per file, which I like because it lets me use tools like find, grep, and glimpse to find individual messages in the archives later.) You can also just specify a filename to archive all mail by month or day in a single mbox file, a la: # you need to make sure this directory exists first ARCHIVEDIR=$HOME/archives YYMM=`date +%Y-%m` # archive everything :0c: $ARCHIVEDIR/$YYMM (that would save all mail into ~/archives/1999-08 ) or, if you just want mutt-users archived by itself, # archive everything :0c: * ^Sender.*mutt-users $ARCHIVEDIR/mutt-users-$YYMM The "c" in ":0c:" says to store a copy of the message and pass the message along to the rest of the procmailrc for further processing. The archive stuff needs to appear near the top of your procmailrc to catch all messages before they get filtered. I recommend using filenames like -mm instead of 1999-aug because they appear in date-order when sorted alphabetically. (like in the output of ls.) Hope this helps, -- Gerald Oskoboiny <[EMAIL PROTECTED]> http://impressive.net/people/gerald/
Re: archiving mailboxes each month
Hi, I wrote a script for myself to rotate the sent-mail folder. I guess you can easily to modify it to rotate other folders as well. Just modify the variables at the beginning and put it in /etc/cron.monthly(debian only). Hope this helps... Shao. Chris Gushue [[EMAIL PROTECTED]] wrote: > Is there a way to archive mailboxes at the beginning of every month (or > some other period) like Pine does? Just after a couple weeks, my > debian-user mailbox (mbox) is 3.6 MB with over 1200 messages. As the > mailbox gets bigger, Mutt takes longer to open it. > > Eg. move the contents of debian-user to debian-user-1999-aug > > Any solution would be great, not necessarily a mutt-specific one > (eg. procmail/crontab/scripts/etc). I'm sure I saw a message about this > on a mailing list I am on, but couldn't find anything. Perhaps it was on > a newsgroup somewhere... > > -- > -- Chris Gushue - ICQ:409207 - [EMAIL PROTECTED] -- > GCS d- s+:- a23 C++>$ UL+++ P+>++ L+++ E W++ N++ o-- K- w--- O- > M-- V-- PS+++ PE Y+ PGP+ t++ 5+ X++ R- tv+ b++ DI+ D+ G++ e h! r y+ > -- http://seymour.napalm.net --- http://owirc.napalm.net -- -- Shao Zhang - Running Debian 2.1 ___ _ _ Department of Communications/ __| |_ __ _ ___ |_ / |_ __ _ _ _ __ _ University of New South Wales \__ \ ' \/ _` / _ \ / /| ' \/ _` | ' \/ _` | Sydney, Australia |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, | Email: [EMAIL PROTECTED] |___/ _ #!/usr/bin/perl #Mutt does not have the feature like pine #which automatically backup the sent-mail #folder each month. #Mutt is designed to be small and effient. #Therefore, this kind of feature will NEVER #go into mutt. The standard answer is to #use cron. And that is why I write this script #Written by Shao Zhang <[EMAIL PROTECTED]> #This program can be freely redistributed with #ABSOULUTELY NO WANRANTY # Program starts here #hopefully, this is where your outgoing mail stores $mail_dir = "/home/shao/mail"; $folder_prefix = "sent-mail"; $current_time = `date`; chop($current_time); $last_month = `date \'+%B\' --date \'last months\'`; chop($last_month); $two_month_ago = `date \'+%B\' --date \'2 months ago\'`; chop($two_month_ago); $current_year = `date \'+%Y\'`; chop($current_year); $last_year = `date \'+%Y\' --date \'last year\'`; chop($last_year); #Let's check if sent-mail is there for update. if (not -f "$mail_dir/$folder_prefix") { print "Error: Cannot find a sent-mail folder in $mail_dir \n"; print "Program exited abnormally \n"; exit 0; } #Check if the old sent-mail folder exists -- eg. sent-mail-March-1999 if (-f "$mail_dir/$folder_prefix-$two_month_ago-$current_year") { #Easy job, we have an old sent-mail-folder saved two months ago. #Now, mv the current sent-mail folder to sent-mail-last_month #and then we can get rid of the old stuff, then we are done. $bool = not `mv $mail_dir/$folder_prefix $mail_dir/$folder_prefix-$last_month-$current_year`; if ($bool) { #Ok, if we have moved the file with no problem $bool = not `rm $mail_dir/$folder_prefix-$two_month_ago-$current_year`; if ($bool) { #Ok, if we have deleted the old stuff with no problem just return; exit 0; } else { #Ok, cannot delete print "Cannot delete the old sent-mail folder\n"; print "Program exited abnormally\n"; exit 0; } } else { #Ok, cannot move, got a problem somehow, I will pass onto you to fix it print "Cannot move the current sent-mail folder to sent-mail-last_months\n"; print "Program exited abnormally\n"; exit 0; } } #Ok, it does not. No big deal, maybe we are going into next year. elsif (-f "$mail_dir/$folder_prefix-$two_month_ago-$last_year") { #Indeed, this is a new year. #Now, we have to be very carefull. Two months ago could be November or December. if ($two_month_ago eq "November") { $bool = not `mv $mail_dir/$folder_prefix $mail_dir/$folder_prefix-$last_month-$last_year`; } elsif ($two_month_ago eq "December") { $bool = not `mv $mail_dir/$folder_prefix $mail_dir/$folder_prefix-$last_month-$current_year`; } else { #Now, we have stuffed up. print "The program is confused about your computer's time\n";
Re: archiving mailboxes each month
On Wed, Aug 18, 1999 at 09:35:20PM -0230, Chris Gushue wrote: > Is there a way to archive mailboxes at the beginning of every month (or > some other period) like Pine does? Just after a couple weeks, my > Any solution would be great, not necessarily a mutt-specific one Try logrotate. I don't know about Debian, but it comes with Red Hat. You can set it to rotate any logs you want, configured individually by different rules. Should fix you up quite nicely. Check your favourite debian resource site or barring that, sunsite.unc.edu. mark-> -- Fairlight-> |||[EMAIL PROTECTED] | Fairlight Consulting __/\__ ||| "I'm talking for free... | http://www.fairlite.com <__<>__> ||| It's a New Religion..." | [EMAIL PROTECTED] \/||| PGP Public Key available via finger @iglou, or Key servers
archiving mailboxes each month
Is there a way to archive mailboxes at the beginning of every month (or some other period) like Pine does? Just after a couple weeks, my debian-user mailbox (mbox) is 3.6 MB with over 1200 messages. As the mailbox gets bigger, Mutt takes longer to open it. Eg. move the contents of debian-user to debian-user-1999-aug Any solution would be great, not necessarily a mutt-specific one (eg. procmail/crontab/scripts/etc). I'm sure I saw a message about this on a mailing list I am on, but couldn't find anything. Perhaps it was on a newsgroup somewhere... -- -- Chris Gushue - ICQ:409207 - [EMAIL PROTECTED] -- GCS d- s+:- a23 C++>$ UL+++ P+>++ L+++ E W++ N++ o-- K- w--- O- M-- V-- PS+++ PE Y+ PGP+ t++ 5+ X++ R- tv+ b++ DI+ D+ G++ e h! r y+ -- http://seymour.napalm.net --- http://owirc.napalm.net -- PGP signature