1834166 Members
3226 Online
110064 Solutions
New Discussion

mail log

 
SOLVED
Go to solution
j773303
Super Advisor

mail log

While remove the /var/adm/syslog/mail.log
or remove mail.log and re-create the mail.log file. Next time, using mail to sendmail, the mail.log will not logs any message. But REBOOT the machine, the mail.log will still logs message. Does anyone know how to touch the mail.log and mail still can logs message properly?
Hero
5 REPLIES 5
Michael Tully
Honored Contributor
Solution

Re: mail log

It sounds like you have removed the mail file and then re-created it. You can't really do this whilst a process (bacground daemon) is using it. You must either edit the file directly or shutdown mail, create a new file and start the mail process. Here is how

# /sbin/init.d/sendmail stop
# rm /var/adm/syslog/mail.log
or
# mv /var/adm/syslog/mail.log /var/adm/syslog/mail.log.save
# touch /var/adm/syslog/mail.log
# chown root:root /var/adm/syslog/mail.log
# chmod 444 /var/adm/syslog/mail.log
Anyone for a Mutiny ?
S.K. Chan
Honored Contributor

Re: mail log

The key is to restart the sendmail daemon (like what Michael has mentioned above) which is why when the system reboots, it restarts the sendmail daemon and the logging continue to work. An additional step is needed at the end to start the daemon.
# /sbin/init.d/sendmail start
Denver Osborn
Honored Contributor

Re: mail log

Don't remove the file and recreate. Just null it out...

> /var/adm/syslog/mail.log

If you need to retain a copy of the log, copy it and don't move it. after it has been copied/archived, then null it to zero bytes.

-denver
T G Manikandan
Honored Contributor

Re: mail log

#cat /dev/null >/var/adm/syslog/mail.log
john korterman
Honored Contributor

Re: mail log

Hi,
SAM has a good facility for trimming logfiles the proper way:
SAM -> Routine tasks -> System Log Files ->
In the list of logfiles select /var/adm/syslog/mail.log select "Actions" -> Trim -> Trim to the recommended size,
which will:
1)trim /var/adm/syslog/mail.log to zero
2)save what corresponds to "The recommended size" of the file to the file /var/adm/syslog/mail.logSAMTRM

New mail messages will hereafter be written to /var/adm/syslog/mail.log.


regards,
John K.
it would be nice if you always got a second chance