e9472285 |
1 | #!/bin/bash |
2 | # |
3 | # Redeliver any messages that may have accidentally been sent to |
4 | # /var/mail/$USER, due to temporary AFS glitches. |
5 | # |
6 | # This should be called as root on deleuze. |
7 | |
8 | for MBOX in /var/mail/*; do |
9 | |
10 | USER=$(basename $MBOX) |
11 | TMPMBOX=/tmp/exim4/$USER.mbox.tmp |
12 | |
13 | # Sanity check: file exists and has nonzero size |
14 | if ! test -s $MBOX; then |
15 | continue |
16 | fi |
17 | |
18 | # Deliver mail. If the message still can't be written to |
19 | # $USER/Maildir, Exim will place it in /var/mail/$USER again. |
20 | mv /var/mail/$USER $TMPMBOX |
21 | formail -s /etc/exim4/deliver-once $USER < $TMPMBOX |
22 | rm -f $TMPMBOX |
23 | done |