summaryrefslogtreecommitdiff
path: root/debian/exim4-base.cron.daily
blob: e98fc94c7ab2f21d61a5281d25b127f66e4beb3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

[ -n "$EX4DEBUG" ] && set -x

# Only do anything if exim4 is actually installed
if [ ! -x /usr/lib/exim4/exim4 ]; then
  exit 0
fi

# Uncomment the following lines to get daily e-mail reports
#if [ -x /usr/sbin/eximstats ]; then
#  eximstats </var/log/exim4/mainlog \
#                    | mail postmaster -s"$(hostname) Daily email activity report"
#fi


# run tidydb as Debian-exim:Debian-exim.
alias exim_tidydb_as_mail='start-stop-daemon --start --exec /usr/sbin/exim_tidydb --chuid Debian-exim:Debian-exim --'

if [ -x /usr/sbin/exim_tidydb ]; then
  cd /var/spool/exim4/db || exit 1
  for file in *; do
    if echo $file | grep \\.lockfile >/dev/null 2>&1; then
	: # skip lock files
    else
	exim_tidydb_as_mail /var/spool/exim4 $file >/dev/null
    fi
  done
fi