procmail
[Top] [All Lists]

Re: Periodically mail procmail's log, without cron?

1999-04-19 20:40:40
Merk Jedlinski wrote,

| If the solution is already available somewhere, please tell me to RTFM... a
| pointer would be nice :) I've looked through Jari's procmail tips, but
| can't find it there.

It's not in any fluffy manual I know of, but I have this very thing set up at
my ripco.com account, where users do not have cron or at access.

| I do remember someone has solved this, but it was a year or so ago and I
| can't find a reference to that anymore. I'm using procmail on my ISP shell
| account, and so I have no accesss to cron. But since procmail runs every
| time an email is delivered to my account, it could replace cron's
| functionality. I'd like to have procmail send its log to me, once a day. I
| only remember it was achieved comparing a timestamp of a dummy file, and
| sending the log if the file's date was older than 'today'.

Some day I'll have to put my code up for public access.  The annoying part
is that it cuts the logfile and starts a new one right while procmail has its
stderr pointed to that inode.  I actually have this line in my .procmailrc
there so that the procmail process that recognized the new calendar date and
called the script that cuts off the logfile will redirect its stderr to a
new file by that name:

  LOGFILE=$LOGFILE

Anyhow, it doesn't exactly compare the timestamp of a dummy file but the
contents.  It depends on two things:

1. a Unix From_ line atop the incoming message with the current timestamp;
2. a version of date that recognizes %-escapes.

The lack of #2 can be worked around by using procmail's extraction to break
down the output that date gives without options.

I'll try to remember to post the code.  The account where I need to use it
doesn't belong to this list, so I'm carboning this message (and forwarding
Marek's) to it.

DWT