procmail
[Top] [All Lists]

Re: date parsing (was: Incrementing a counter)

1997-10-10 16:18:41
J. Daniel Smith wrote:
Edward J. Sabol writes on 9 October 1997 at 18:20:24
Excerpts from mail: (09-Oct-97) Incrementing a counter by Bill Moseley
TODAY=`date '+%m%y%d'`

Instead of forking a `date' process, I suggest parsing the date from the
From_ header. (Warning: I don't think all From_ headers look exactly the
same, so you should test this first.)
[...]

Alan Stebbens' <aks(_at_)sgi(_dot_)com> procmail library has a date.rc module
which you may find useful.  You can get the entire library from
  http://reality.sgi.com/aks/depot/mail/procmail/procmail-lib.shar
Here's some of the commentary from date.rc


These routines are a great time saver in their place. If you live in
the same timezone as your server (or as the environment under which
sendmail executes), they should serve you well. If you do not, you
should consider the following:

. When it is 30 minutes before or after midnight per the time stamp,
which day is it for you? Which month is it when this happens at the
beginning or end of the month, and which year...?

. In the wee hours after a change to or from standard time for your
Server, what is the correct time of day to use (if your are tracking
hours as well as dates)?

You _can_ handle these completely within procmail. The complexity of
doing so convinced me that setting TZ and invoking date is worth the
cost in hair loss. My current setup does this once, pulling in the date
and time for later parsing and manipulation within procmail.

Of course, if someone has an rc to handle these problems as well, I
would be happy to learn from it. Also, if there is a way to have my
ISPs sendmail insert datestamps from my timezone, I would appreciate
learning how to do it.

-- 
Rik Kabel          Old enough to be an adult           rik(_at_)netcom(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>