[cc lang="bash"]
\$ apt-get install pflogsumm bsd-mailx
\$ vi /etc/logrotate.conf
\$ vi /etc/postfix/daily_report.sh
\$ chmod +x /etc/postfix/daily_report.sh
\$ crontab -e
[/cc]
/etc/logrotate.conf
[cc lang="bash"]
.....
/var/log/mail.log {
missingok
daily
rotate 7
create
compress
start 0
}
[/cc]
/etc/postfix/daily_report.sh
[cc lang="bash"]
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/bin/gunzip /var/log/mail.log.0.gz /bin/gunzip /var/log/mail.log.1.gz (echo ' ~~~~ {style="font-size:12px"} '; pflogsumm -d yesterday --problems_first /var/log/mail.log.0 /var/log/mail.log.1) | /usr/bin/bsd-mailx -a"From: pflogsumm@mail.jokeru.ro" -a"Subject: Mail Server Statistics - mail.jokeru.ro" -a"MIME-Version: 1.0" -a"Content-Type: text/html;charset=iso-8859-1" postmaster /bin/gzip /var/log/mail.log.0 /bin/gzip /var/log/mail.log.1 exit 0 [/cc] crontab [cc lang="bash"] 00 10 * * * /etc/postfix/daily_report.sh &> /dev/null [/cc] ~~~~