Red Hat Bugzilla – Bug 14360
RFE: samba logrotate script
Last modified: 2008-05-01 11:37:56 EDT
Before 2.0.6 samba didn't reopen logs after an HUP.
In 2.0.6 this has been taken care of, but it still fails reopening the
logs for active connections.
1) Stop samba, delete all logs, start samba
2) From a win box, <machine>, click on a samba share, and do nothing -> a
<machine>.log file is created
3) move the <machine>.log to <machine>.log.1
4) killall -HUP smbd nmbd
5) From the same win box click on another share -> <machine>.log.1 is used.
6) smbstatus and then kill the PID of <machine>
7) from the win box click on a samba share -> a new <machine>.log is
This causes problems after logrotate is run if there were active
connections, especially if someone decided to compress logs.
To fix this I have always used logrotate's "copytruncate" option in samba
logrotate script, even if the man page of logrotate says there's a
drawback using this option.
Maybe you could add "copytruncate" commented out in samba logrotate
script, so that if someone has the logs not properly rotated he has a
quick way to fix it.
# try uncommenting 'copytruncate' if logs are not rotated properly,
# read the logrotate man page for this option effect.
/bin/kill -HUP `cat /var/lock/samba/*.pid 2> /dev/null`
2> /dev/null ||
This defect is considered MUST-FIX for Winston Beta-5
copytruncate is added as of samba-2.0.7-17.