procmail
[Top] [All Lists]

Re: timestamp in the procmail log?

2007-06-02 04:45:24
On Sat, Jun 02, 2007 at 01:04:40AM -0600, LuKreme wrote:

On 1-Jun-2007, at 16:07, Dallman Ross wrote:

Okay, but I don't see a need to run `date` twice in your
rcfile -- or even once, depending on the options you
use to call procomail in your .forward or on your system.

Sure, I COULD finagle around with getting the date some other way,  
but there were a variety of reason why rewriting the FROM_ header or  
getting the date from the FROM_ header was not acceptable to me at  
the time I first wrote these recipes (a lot of mail I was processing  
was archived email that was being resorted under a new server.

`date` is cheap and I have no issues with calling it, even twice.   
And yeah, I know, I could just call it once and then set the two  
dates from there.  But sometimes ease of reading is an advantage.

For example, I have code similar to yours for 'fixing' dates in the  
FROM_ headers that where munged by Eudora.  In fact, you probably  
wrote a healthy percentage of that code three or four years back..  
But which is more readable, the 20 lines you have or

DATE=`date '+%d-%b-%Y'`
LONGDATE=`date "+%y-%b-%d %I:%M:%S %z"`

?

I don't need 20 lines.  It's an INCLUDERC.

  INCLUDERC = $SUBS/datecheck

And I haven't had to look at it in years.

The thing is, I need and want those values anyway.  If I ran /bin/date,
I'd still want to create all those vars for the stuff I do.

Another approach, that, so far as I know, David Tamkin was first to
post about circa seven or nine years ago, was to generate a file
daily, e.g., with cron.  I did that for a number of years as well.
The file had in it, e.g., 

   MYDATE = 02-Jun-2007

Now it can be read in with an INCLUDERC and doesn't require a
call to date with every single email.  If you're processing old
mail, you could do that.

You could also have a test to compare the From_ date against
that read-in MYDATE and only bother to run /bin/date to get your
timestamp if the two are different; otherwise assume the message
timestamp is to be used.

If you are processing new mail, the timestamp in the From_ will
be sufficient for a log entry.  If you are processing old mail,
you may not *want* the timestamp in the log entry anyway.  So
use a different rcfile and do it differently.

Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail