procmail
[Top] [All Lists]

Re: archiving problem

1998-10-28 03:32:36
On Tue, 27 Oct 1998 21:51:27 -0500 (EST), Justin Lloyd
<jlloyd(_at_)harris(_dot_)com> wrote:
I am trying to set up .procmailrc to archive it's own log via a
monthly cron job.

Why do you need to invoke Procmail to do this? Why not just put
something like this in your crontab:

42 4 1 1 *
  mv -f $HOME/Mail/procmail.log $HOME/Mail/procmail.log.`date -d "month ago" 
+%y%m`

I can see how it might be useful to get Procmail's idea of the value
of LOGFILE, but invoking Procmail just to get that seems a bit
complicated. Unless the value of LOGFILE really depends a lot on
various recipes, how about putting the LOGFILE assignment in an
external rc.file you can source from sh as well as INCLUDERC= from
within Procmail?

   :0
   {
      LOGDATE = `echo "$YYYY $MM" | perl -lane '--$F[1] or --$F[0] and 
$F[1]=12; printf "%d-%02d\n", @F'`
      ARCHIVE = "$LOGFILE.$LOGDATE"
   }

(You don't need the :0 and the braces here at all.)

   LOG = "Archiving procmail log to $ARCHIVE$NL"
   :0 hwi
   * !
   | ( mv $LOGFILE $ARCHIVE ;\
       touch $LOGFILE       ;\
       chmod 400 $ARCHIVE )

If you already know you are -a archive, is there a specific reason
you're checking for absence of headers?

Procmail will recreate the log if it doesn't exist, so there's no real
need to touch it, I believe.

But why is anything getting delivered at all?

This is of course the main Procmail question here, but I can't answer
that. Indeed, the :0hwi recipe should be delivering from Procmail's
point of view, should it not? (If Procmail gets an error from the
pipeline, shouldn't that be reported in the log?)

/* era */

-- 
Bot Bait: It shouldn't even matter whether  (`')  Just  (`')  http://www.iki
I am a resident of the State of Washington   \/ Married! \/   .fi/~era/

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