--- /dev/null
+#!/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