Subject: Re: Archive question

From: Dimitri Tischenko <[email-masked]>
Date: Wed, 18 Jan 1995 22:45:10 +0100 (MET)

Regadring the extraction of the month: a possible solution is

% date | awk '{print $2}'
Jan

DbT
--
+------------------------------------------------------------------------+
| Dimitri Tischenko | [email-masked] | NeXTmail preferred! |
+------------------------------------+-----------------------------------+
| Delft University of Technology     | NeGeN                             |
| Fac Applied Math & Computer Science| NEXTSTEP Gebruikers Nederland     |
| Dep of Statistics, Probabilitistics| NiNe                              |
|  and Operations Research           | NEXTSTEP In the Netherlands       |
+------------------------------------+-----------------------------------+

---

From: [email-masked] (David W. Tamkin)
Date: Wed, 18 Jan 1995 12:41:37 -0600 (CST)

Mark Anderson asked,

| Is there anyway that procmail can be used to create a new
| folder automatically at the beginning of each month to save messages from
| the lists I subscribe to?
|
| For example:
|
| 	:0c
| 	* ^TOfunlist
| 	  funlist
|
| 	  :A
| 	  funlist-archive

| What I would like is to have the archive line actually change to the
| current month and save the archive copy to something like:
|
| 		funlist-archive-jan
| and then:	funlist-archive-feb  etc.

date(1), if you have even a half-way decent version, can output the first
three characters of the name of the month, but they'll start with a capital
and worse, you'll have to run date [and a shell and tr] every time a message
from the Funlist List comes in, like this:

  :0c:
  * ^TOfunlist
  funlist
   :0A:
   funlist-archive-`date +%b | tr ADFJMNOS adfjmnos`

To avoid the extra processes with every delivery, you could do this at the
beginning of your .procmailrc:

thismonth=jan

or change your .forward to something on the order of

"|IFS=' ' && exec thismonth=jan /path/to/procmail || exit 75 # manderso"

and have recipes like this:

  :0c:
  * ^TOfunlist
  funlist
   :0A:
   funlist-archive-$thismonth

but you'd have to change the value of $thismonth manually on the first day
of every month.  You could set up a cron job to do that, but that in itself
can be a pain too, since I find that editing from a cron job is unreliable.
[A cron job to rewrite your .forward completely for the new month is a
possibility, though.]

If the format of the From_ or Date: header on mail from the Funlist List is
consistent, and you're using procmail 3.10, you can extract the month from
there.  In fact, if you're willing to tolerate the capital letter, that will
simplify things greatly:

 :0c:
 * ^TOfunlist
 funlist
  :0A:
  * ^Date:.* \/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
  funlist-archive-$MATCH

If the capital letter is completely unacceptable, well, here goes, with
no outside programs:

 :0c:
 * ^TOfunlist
 funlist
  :0A
  * ^Date:.* \/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
  {
   Month=$MATCH

   :0: # January, June, July
   * Month ?? J\/..
   funlist-archive-j$MATCH
   :0E: # March, May
   * Month ?? M\/..
   funlist-archive-m$MATCH
   :0E: # April, August
   * Month ?? A\/..
   funlist-archive-a$MATCH
   :0E:
   * Month ?? Oct
   funlist-archive-oct
   :0E:
   * Month ?? Dec
   funlist-archive-dec
   :0E:
   * Month ?? Sep
   funlist-archive-sep
   :0E:
   * Month ?? Nov
   funlist-archive-nov
   :0E:
   * Month ?? Feb
   funlist-archive-feb
  }

| Bonus question:  With this simple set up I can't remember if I need to
| use a lockfile or not.  Should it be:   :0c:  at the top or just  :0c

If there's even the slightest risk of getting two Funlist messages at the
same time, yes.  If it's an announcement sent once a week, you can probably
do without the local lockfile.

---

From: Mark Anderson <[email-masked]>
Date: Wed, 18 Jan 1995 09:42:13 -0800 (PST)

I'm currenly using procmail to store incoming messages into folders 
which I later convert into HTML for archives.  At the moment I just have 
one folder for each list, but its getting to the point where I have 300 
or so messages in the folder.  I'd like to set this process up so that 
it's a little more structured and organized based on a new folder for 
each month.  Is there anyway that procmail can be used to create a new 
folder automatically at the beginning of each month to save messages from 
the lists I subscribe to?

For example:

	:0c
	* ^TOfunlist
	  funlist

	  :A 
	  funlist-archive

What I would like is to have the archive line actually change to the 
current month and save the archive copy to something like: 

		funlist-archive-jan
and then:	funlist-archive-feb  etc.

Bonus question:  With this simple set up I can't remember if I need to 
use a lockfile or not.  Should it be:   :0c:  at the top or just  :0c

Thanks, Mark

-- 
Mark Anderson   [email-masked]