Bug 14360

Summary: RFE: samba logrotate script
Product: [Retired] Red Hat Linux Reporter: giulioo
Component: sambaAssignee: Trond Eivind Glomsrxd <teg>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-07-21 18:17:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description giulioo 2000-07-21 08:45:32 UTC
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.

Example:
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 
created/used.

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.

ie:
/etc/logrotate.d/samba

/var/log/samba/*.log {
    notifempty
    missingok
# try uncommenting 'copytruncate' if logs are not rotated properly,
# read the logrotate man page for this option effect.
#   copytruncate
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/lock/samba/*.pid 2> /dev/null` 
2> /dev/null ||
true
    endscript
}

Comment 1 Glen Foster 2000-07-21 18:17:05 UTC
This defect is considered MUST-FIX for Winston Beta-5

Comment 2 Bill Nottingham 2000-07-21 18:22:56 UTC
copytruncate is added as of samba-2.0.7-17.