]> git.pld-linux.org Git - packages/exim.git/blobdiff - exim.cron.db
- up to 4.89.1 (which is the same as ours 4.89-10)
[packages/exim.git] / exim.cron.db
index 1d5f00183a1dc3f3a16f63682ba8625209aeedc0..4e5927b50a81bef1cb113f68cca1281958b4e691 100644 (file)
@@ -1,10 +1,30 @@
 #!/bin/sh
 cd /
 
-SPOOLDIR="$(/usr/bin/exim -bP spool_directory | /bin/sed 's/.*=[[:space:]]\(.*\)/\1/')"
+SPOOLDIR="$(/usr/bin/exim -bP spool_directory 2> /dev/null | /bin/sed 's/.*=[[:space:]]\(.*\)/\1/')"
 
 [ ! -d "$SPOOLDIR" ] && echo "Spooldir [$SPOOLDIR] is not a directory" && exit 1
 
-/usr/bin/find $SPOOLDIR/db -maxdepth 1 -name '*.lockfile' -or -type f -printf '%f\0' | xargs -0r -n 1 /usr/bin/exim_tidydb $SPOOLDIR > /dev/null
+for db in $(/usr/bin/find $SPOOLDIR/db -maxdepth 1 -name '*.lockfile' -or -type f -printf '%f\n'); do
+       t=
+       case "$db" in
+               callout)
+                       t="-t 7d"
+                       ;;
+               *)
+                       ;;
+       esac
+       /usr/bin/exim_tidydb $t $SPOOLDIR $db > /dev/null
+       # Try to lower it's size if it is bigger than 300M. Result still can be bigger if the db contains
+       # so much unexpired data.
+       toobig=$(/usr/bin/find $SPOOLDIR/db/$db -size +300M)
+       if [ -n "$toobig" ]; then
+               /usr/bin/exim_dumpdb $SPOOLDIR $db | /usr/bin/exim_dbmbuild -nowarn - $SPOOLDIR/db/$db.new > /dev/null
+               chown exim:exim $SPOOLDIR/db/$db.new
+               chmod 640 $SPOOLDIR/db/$db.new
+               mv $SPOOLDIR/db/$db.new $SPOOLDIR/db/$db
+       fi
+
+done
 
 exit 0
This page took 0.231061 seconds and 4 git commands to generate.