tobi:
> So I thought that must be solved somehow easier and more automatically.
> My basic idea is to regularly scan the mailq for mails defered by
> "overquota". From these mails in queue I fetch the recipients and add
> them to a recipient-restriction file for postfix. So postfix can reject
> such mails before the queue.
That is a reasonable approach.
> mailq | tail -n +2| awk 'BEGIN {RS = ""} /over quota/ {print $NF}' |
> grep -v maildrop: | sort -n | uniq -c | sort -nr | awk '{if($1>
> '"$LIMIT"') print $2}' > $TFILE
This misses all the users that are over quota but did not get mail.
What about parsing "du" output? This way you can find out all users
that are over quota.
> cp -f /root/overquota /etc/postfix/
> postmap /etc/postfix/overquota
> postfix reload
Safer:
postmap /etc/postfix/overquota.new && mv /etc/postfix/overquota.new.db
/etc/postfix/overquota.db
Wietse