Subject: Fully Replacing HLFSD with Procmail

From: (Dave Lopata) <[email-masked]>
Date: Thu, 23 Mar 1995 14:18:56 -0500

...

	Below is the script I've come up with, thanks to many people
on this list, that provides what I *think* is a robust method for
dealing with instances where an NFS mounted home file system cannot be
reached (and, of course, you deliver to $HOME/something).  Obviously,
this script needs to go in /usr/local/etc/procmailrc.

	My basic premise was that, if the mail could get to my server,
*I* should be able to get it to the user; it shouldn't bounce just
because a particular file system was down for half a day.

	To me, the script below seems actually better than HLFSD,
because HLFSD required a cron job to clear the mail from the
alternative mail spool; this script automatically retransmits it as
soon as it is able to send a single valid message.

	We're still testing this, so if any of you see something
bad in it, I'd appreciate your comments.  

LOGABSTRACT=all
LOGFILE    =/spool/logs/procmail
ALTERNATE  =/var/alt.mail/$LOGNAME
FLUSH      =/var/alt.mail/$LOGNAME.flush
RC         =$HOME/.procmailrc
 
DROPPRIVS=yes
 
#
# Can we even find the $HOME?
#
:0
* ?test -r $HOME
{
  #
  # If so, is there any $ALTERNATE Mail to be delivered?
  #
        :0c
        * ?test -r $ALTERNATE
        | mv $ALTERNATE $FLUSH ; \
          cat $FLUSH | /usr/local/bin/formail -s $SENDMAIL -oi -t
  #
  # If So, do we have a .procmailrc?
  #
        :0
        * ?test -r $RC
        {
                INCLUDERC=$RC
        }
  #
  # If Not, let's pitch to $DEFAULT
  #
        :0 w:
        $DEFAULT
    #
    # If we fail, pitch to the $ALTERNATE
    #
                :0 ew:
                $ALTERNATE
}
#
# If Not, let's pitch to the $ALTERNATE
#
:0 w:
 $ALTERNATE