#!/bin/sh # # /etc/cron.daily/1postfix # # This file is run on a daily basis to perform checks on your postfix # configuration and to analyse your mail logs. # # The file is named "1postfix" to ensure that it is run before logrotate # when the /var/log/maillog files are rotated. # # The file is also flagged by rpm as a configuration file, so if you modify # it, further upgrades to postfix will not be overwriten. # # More information at http://jimsun.linxnet.com/postfix_contrib.html # # uncomment the next line to completely disable the daily cronjob # exit 0 LOGFILE=/var/log/maillog EXECUTABLE=/usr/sbin/pflogsumm.pl PFLOGSUMTMP=/etc/postfix/pfls.tmp.$$ # safer directory than /tmp #OPTIONS="--verp_mung=2 --problems_first --iso_date_time -q -u 10 -h 10 -d yesterday" OPTIONS="--verp_mung=2 --problems_first --iso_date_time -q -u 10 -h 10" SUBJECT="`hostname` Daily Mail Report for `LC_CTIME=C date +\"%A, %d %B %Y\"`" POSTMASTER="postmaster@localhost" SENDMAIL=/usr/sbin/sendmail SENDMAIL_OPTS="-oi -t" # Clean up when done or when aborting. trap "rm -f ${PFLOGSUMTMP}" 0 1 2 3 15 [ -x /usr/sbin/postfix ] || exit 0 /usr/sbin/postfix check # uncomment the next line to disable retrieval of mail statistics # exit 0 # Invoke pflogsumm.pl to gather statistics # see http://jimsun.linxnet.com/postfix_contrib.html for further info. [ -x /usr/sbin/pflogsumm.pl ] || exit 0 # WARNING - This is a bit of a hack # # pflogsumm.pl needs Date::Calc to work so we do the following: # Check if our installation works with Date::Calc # - if so, use pflogsumm.pl directly # - if not filter out the Date::Calc useage and use the resulting script perl -e "use Date::Calc;" 2>/dev/null || { # strip out Date::Calc from pflogsumm.pl sed -e '/# ---Begin:/,/# ---End:/d' < ${EXECUTABLE} > ${PFLOGSUMTMP} chmod u=x,go= ${PFLOGSUMTMP} EXECUTABLE=${PFLOGSUMTMP} } # Double check that the sendmail binary exists before proceeding [ -x ${SENDMAIL} ] || exit 0 ( cat <