Enable sendmail mailstats
Running mailstats on a debian etch server running sendmail was returning the following error:
# /usr/sbin/mailstats
MSP statistics...
mailstats: /var/lib/sendmail/sm-client.st: No such file or directory
MTA statistics...
mailstats: /var/lib/sendmail/sendmail.st: No such file or directory
The StatusFile was enabled in sendmail.cf (the default location as no definition was overwritten in sendmail.mc):
# grep StatusFile /etc/mail/sendmail.cf
O StatusFile=/var/lib/sendmail/sendmail.st
Still this was not working… In order to have this working we have to touch the status files (the ones defined in sendmail.cf and submit.cf):
# touch /var/lib/sendmail/sm-client.st
# touch /var/lib/sendmail/sendmail.st
After this (sendmail restart is not needed), sendmail will start loging information to the files and the mailstats command will start working properly:
#mailstats
MSP statistics...
Statistics from Fri Aug 22 13:47:40 2008
M msgsfr bytes_from msgsto bytes_to msgsrej msgsdis msgsqur Mailer
=====================================================================
T 0 0K 0 0K 0 0 0
C 0 0 0
MTA statistics...
Statistics from Fri Aug 22 13:46:36 2008
M msgsfr bytes_from msgsto bytes_to msgsrej msgsdis msgsqur Mailer
3 56 70K 2 4K 0 0 0 local
5 6 129K 75 224K 0 0 0 esmtp
=====================================================================
T 62 199K 77 228K 0 0 0
If you want to reset this information from time to time you should call in a cron job:
mailstats -p > /dev/null