EXIM_LOG="/var/log/exim/mainlog.1";
DIR="/var/www/html/eximstats";
CUR_DIR="${DIR}/`date --date=yesterday +%Y/%m/%d`";
if [ ! -d "${CUR_DIR}" ]; then
mkdir -p ${CUR_DIR};
echo "Options +Indexes" > "${DIR}/.htaccess"
echo "Allow from 127.0.0.1" >> "${DIR}/.htaccess"
echo "Deny from all" >> "${DIR}/.htaccess"
fi;
/usr/sbin/eximstats -html ${EXIM_LOG} > ${CUR_DIR}/index.html