procmail
[Top] [All Lists]

Example: Rules activating on reduced Mail spool space

1997-05-21 09:35:00

### Rules depend on Mail spool space 

PATH=$HOME/bin:/opt/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin
SHELL=/opt/bin/bash

awk=/bin/awk
MAILDIR=$HOME/Mail
LOGFILE=$MAILDIR/MAILLOG

MAILSPACE=writable
AWK_SCRIPT='if ( $2 != "" ) {
    cur = $2
    max = $3
} else {
    getline
    cur = $1
    max = $2
}
if ( cur/max > .75 ) {
    print cur/max
}'
NOSPACE=`quota -v |$awk "/$MAILSPACE/ { $AWK_SCRIPT }"`

########### Rules ########################################

# store insufficient spool space, store "mailing list" in overflow
:0 fhw:
* ? test $NOSPACE
* ((^CC|^TO)amanda*|\
  (^CC|^TO)mutt*|\
  ^Sender:.*ssh|\
  ^From:.*Economis*|\
  ^X-Loop:.*debian*|\
  ^X-Loop:.*procmail)
| formail -rA"Mail_Lost: quota -v |$awk /$MAILSPACE/ { $AWK_SCRIPT }"
overflow

# Note the current "formail" line is for debuging"
# An alternative
# | formail -rA"Mail_Lost: Mailing list lost, insufficient Mail Spool space"



# Anything that has not been delivered by now will go to $DEFAULT

# After procmail sees the end of the rcfile, it pretends that it sees a
# Therefore $DEFAULT is always locked.

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