]>
Commit | Line | Data |
---|---|---|
7f0182a7 AM |
1 | #!/bin/sh |
2 | cd / | |
2bb95240 | 3 | |
953da21f | 4 | SPOOLDIR="$(/usr/bin/exim -bP spool_directory 2> /dev/null | /bin/sed 's/.*=[[:space:]]\(.*\)/\1/')" |
2bb95240 AM |
5 | |
6 | [ ! -d "$SPOOLDIR" ] && echo "Spooldir [$SPOOLDIR] is not a directory" && exit 1 | |
7 | ||
6f06d0c5 AM |
8 | for db in $(/usr/bin/find $SPOOLDIR/db -maxdepth 1 -name '*.lockfile' -or -type f -printf '%f\n'); do |
9 | t= | |
10 | case "$db" in | |
11 | callout) | |
dfb6c847 | 12 | t="-t 7d" |
6f06d0c5 AM |
13 | ;; |
14 | *) | |
15 | ;; | |
16 | esac | |
17 | /usr/bin/exim_tidydb $t $SPOOLDIR $db > /dev/null | |
dfb6c847 AM |
18 | # Try to lower it's size if it is bigger than 300M. Result still can be bigger if the db contains |
19 | # so much unexpired data. | |
20 | toobig=$(/usr/bin/find $SPOOLDIR/db/$db -size +300M) | |
21 | if [ -n "$toobig" ]; then | |
22 | /usr/bin/exim_dumpdb $SPOOLDIR $db | /usr/bin/exim_dbmbuild -nowarn - $SPOOLDIR/db/$db.new > /dev/null | |
23 | chown exim:exim $SPOOLDIR/db/$db.new | |
24 | chmod 640 $SPOOLDIR/db/$db.new | |
25 | mv $SPOOLDIR/db/$db.new $SPOOLDIR/db/$db | |
26 | fi | |
27 | ||
6f06d0c5 | 28 | done |
9abc83e7 AM |
29 | |
30 | exit 0 |