procmail
[Top] [All Lists]

Re: changing log file within a 'c'

1999-09-23 11:27:07
Timothy J Luoma <tjlists(_at_)bigfoot(_dot_)com> writes:
Replying to message of Thu, 23 Sep 1999 11:55:38 -0500
      from Philip Guenther <guenther(_at_)gac(_dot_)edu>
      regarding ``Re: changing log file within a 'c' ''
...
# if that didn't work, try just /tmp
:0:
/tmp/emailbackups.luomat.$$

I would follow that with:

# It *still* didn't work!  Log an error then toss this copy.
LOG = "procmail: Help me, help me -- couldn't deliver to /tmp!
"
HOST

I suppose a full /tmp filesystem could occur.

Since this is to be my backup, I wouldn't want to dump it to HOST but I'll  
have to look into that.

That's the problem with cloned children: there's no easy way for them
to report their status to the parent.  If you can't save a backup copy,
you really want to abort the entire thing (child _and_ parent) and return
an error to the MTA It delays the processing but it's safe.

Hmm, you can actually do your backup recipes as a series of simple
recipes with the 'c' and/or 'e' flags and thereby avoid the cloning:

        # Make sure we don't log these:
        LOGABSTRACT = off

        # CHECK to make sure that the backup directory exists
        # If not, create it
        :0 ci
        * ! ? /usr/local/gnu/bin/test -d /tmp/luomat/emailbackups/
        |/usr/local/gnu/bin/mkdir -p /tmp/luomat/emailbackups/

        # save the message to /tmp/luomat/emailbackups
        :0 cw:
        /tmp/luomat/emailbackups/$$

        # Turn logging back on
        LOGABSTRACT = all

        # if the save didn't work, try just /tmp
        :0 ec:
        /tmp/emailbackups.luomat.$$

        # XXX if LOGFILE is not normally /dev/console, then the previous
        # XXX recipe should instead be a nested block that sets LOGFILE:
        # XXX Note carefully the position of the flags
        # :0 e
        # {
        #    oLOGILE = $LOGFILE
        #    LOGFILE = /dev/console
        #    :0 c:
        #    /tmp/emailbacksups.luomat.$$
        #    LOGFILE = $oLOGFILE
        # }

        :0 e
        {
            # Argh!  We couldn't save a backup copy.  Give up processing
            # and return EX_CANTCREAT=73 to the MTA.
            EXITCODE = 73
            HOST
        }


Philip Guenther

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