#!/bin/sh -e

. /etc/ifmail/ifshellvars

[ -d $IFLOGDIR ] || exit 0 

cd $IFLOGDIR 

# Rotate the logfiles.
for LOG in ifdebug iflog; do
  if [ -s $LOG ]; then
    savelog -u $IFUSER -g adm -m 600 -c 4 $LOG > /dev/null
  fi
done
$IFBIN/fido.daily iflog.0 | mail -s "Ifmail logs report" $IFUSER

# remove old files and directories
#find $IFSPOOL/ -type f -atime +14 -print0 \
#	-name '*.sts' \
#	| xargs --no-run-if-empty --null rm -f

#find $IFSPOOL/ -type d -mtime +30 -print0 \
#	-name '*.*' -not -name $IFNLDIRNAME\
#	| xargs --no-run-if-empty --null rmdir

