Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

/var/adm/syslog/mail.log

ROSS HANSON
Regular Advisor

/var/adm/syslog/mail.log

How do you restart mail.log?
I moved the old mail.log file with another name
a couple of days ago and I still have 0 in my mail.log. I have restarted sendmail thinking that would do it but not so. Anybody know?
Ross Hanson
3 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: /var/adm/syslog/mail.log

Hi:

# /sbin/init.d/sendmail stop
# /sbin/init.d/sendmail start

Regards!

...JRF...
Jim Walls
Trusted Contributor

Re: /var/adm/syslog/mail.log

You need to tell syslogd to re-initialise:

mv /var/adm/syslog/mail.log /var/adm/syslog/mail.log.1
kill -HUP $(cat /var/run/syslog.pid)

Bill Hassell
Honored Contributor

Re: /var/adm/syslog/mail.log

The mv command simply renames the file in the directory, but syslog still has the file open. You have to restart syslogd so it will close the current file and open the new file. However, a better way to do this is to use cp -p and then zero the contents of the current file, like this:

# cp -p mail.log mail.log.old
$ cat /dev/null > mail.log

You can also zero the log with:

# > mail.log

There are two advantages to this method:

1. The mail.log file can remain open and syslogd will continue to log without interruption, and

2. the current mail.log and the copy of the old file will have the correct permissions and ownership.


Bill Hassell, sysadmin