Installing and Administering Internet Services

158 Chapter 4
Installing and Administering sendmail
Troubleshooting sendmail
to= The recipient of the message. One message may have
multiple recipients. sendmail logs a separate entry for
each separate delivery attempt it makes, so multiple
recipients on the same host may appear on the same
line, but multiple recipients on different hosts will
appear on different lines. The delivery status of the
message (whether message succeeded, failed, or was
queued), the mailer, and the host used are logged.
Queued messages and SYSERRs are also logged.
Storing Off Old sendmail Log Files
At typical logging levels, every piece of mail passing through sendmail
adds two or three lines to the mail log. A script to manage the growth of
the mail log could be run nightly, at midnight, with an entry in root’s
crontab file. Following is an example of a crontab entry for a script
called newsyslog:
0 0 * * * /var/adm/syslog/newsyslog
The following example shows what the script
/var/adm/syslog/newsyslog might contain. The script assumes that
syslog is configured to direct mail logging to
/var/adm/syslog/mail.log.
#!/usr/bin/sh
#
# NEWSYSLOG: save only the last week’s sendmail logging
#
cd /var/adm/syslog
mv mail.log.6 mail.log.7
mv mail.log.5 mail.log.6
mv mail.log.4 mail.log.5
mv mail.log.3 mail.log.4
mv mail.log.2 mail.log.3
mv mail.log.1 mail.log.2
cp mail.log mail.log.1
kill -1 `cat /var/run/syslog.pid`
Printing and Reading the Mail Queue
The current contents of the mail queue can be printed with the following
command:
mailq
The output looks similar to this example:.