procmail
[Top] [All Lists]

Re: Odd error.

1997-03-29 14:20:44
On Sat, 29 Mar 1997 14:11:05 -0600,
Philip Guenther <guenther(_at_)gac(_dot_)edu> wrote:
Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> writes:
Can't one avoid writing *any* of the header or body?  Something like:
:0c:log.gz.lock  # now I think you need to name the lock
{
    JUNK="`/usr/local/gnu/bin/date +'%e/%m/%y, %k:%M'`"
    JUNK="`echo $VAR8 lines, $JUNK, $VAR9, $VAR10 | gzip >> log.gz`"
}
procmail provides the entire message on stdin of programs started via
backquotes, so no, this doesn't help.  

This is pretty contrived and moreover untested, but backticks inside a
LOG pseudo-statement(*) don't eat standard input, do they?

    OLDLOG=$LOGFILE
    LOGFILE=log.tmp
    LOG="`lockfile log.tmp.lock`"
    # The previous should in fact not write anything to the log
    LOG="... the message you actually wanted to have logged ...
"
    LOG="`gzip -c log.tmp >>log.gz; rm -rf log.tmp.lock log.tmp`"

Of course, as soon as you start getting error messages (such as when
log.gz doesn't exist, under the shell I'm using at least), they will
show up in the log too. (That's not so bad, come to think of it :-)

/* era */

I'll freely admit this idea to use the logging facility is stolen from
something somebody else posted to the list once, as usual. (Credit in
this case is due to Philip Guenther if memory serves, and if I can
spell his name right.-/

* (What should you call that anyway, a variable assignment which
doesn't really assign any variables but has interesting side effects?
A kludge? :-)

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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