From: bigmike160 Date: Fri, 19 Oct 2007 18:55:42 +0000 (+0000) Subject: redeliver-mail: new script to redeliver all mail in /var/mail X-Git-Url: http://git.hcoop.net/clinton/scripts.git/commitdiff_plain/d96599bf6b2ac9eb4ee176d86ac93666007694ad?ds=sidebyside redeliver-mail: new script to redeliver all mail in /var/mail --- diff --git a/redeliver-mail b/redeliver-mail new file mode 100755 index 0000000..0d68870 --- /dev/null +++ b/redeliver-mail @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Redeliver any messages that may have accidentally been sent to +# /var/mail/$USER, due to temporary AFS glitches. +# +# This should be called as root on deleuze. + +for MBOX in /var/mail/*; do + + USER=$(basename $MBOX) + TMPMBOX=/tmp/exim4/$USER.mbox.tmp + + # Sanity check: file exists and has nonzero size + if ! test -s $MBOX; then + continue + fi + + # Deliver mail. If the message still can't be written to + # $USER/Maildir, Exim will place it in /var/mail/$USER again. + mv /var/mail/$USER $TMPMBOX + formail -s /etc/exim4/deliver-once $USER < $TMPMBOX + rm -f $TMPMBOX +done