Bug 113840

Summary: Logrotate executes post rotate scripts every day
Product: Red Hat Enterprise Linux 2.1 Reporter: Silver Kuusk <silver.kuusk>
Component: logrotateAssignee: Peter Vrabec <pvrabec>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-04-28 15:37:34 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 Silver Kuusk 2004-01-19 13:22:09 UTC
Description of problem:
The post rotate scripts on weekly and monthly rotations jobs are 
running every day.

Version-Release number of selected component (if applicable):
logrotate-3.5.9-1

How reproducible:
Every time

Steps to Reproduce:
Create configuration file for a weekly rotations job.
Example files in /etc/logrotate.d 
âcat apacheâ

/usr/local/apache/logs/*log {
  weekly
  rotate 6
  compress
  delaycompress
  olddir /usr/local/apache/logs/arhiiv
  sharedscripts
  postrotate
    /usr/local/apache/bin/apachectl graceful
    /bin/sleep 10
    /root/bin/webalizer.1
  endscript
}

or original RH syslog file âcat syslogâ:
 
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /v
ar/log/boot.log /var/log/cron {
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 
2> /dev/null || true
    endscript
}

2. Check message log or check mail from cron daemon on next days.
 
Actual results:
I âm getting a mail from cron daemon every day:

Subject: Cron <root@brc> run-parts /etc/cron.daily

/etc/cron.daily/logrotate:

/usr/local/apache/bin/apachectl graceful: httpd gracefully restarted

The post rotate script for syslog is running every day (lines from 
message log):
Jan 11 04:14:28 www syslogd 1.4.1: restart.
Jan 12 04:09:26 www syslogd 1.4.1: restart.
Jan 13 04:08:02 www syslogd 1.4.1: restart.
Jan 14 04:09:20 www syslogd 1.4.1: restart.
Jan 15 04:09:07 www syslogd 1.4.1: restart.
Jan 16 04:08:32 www syslogd 1.4.1: restart.
Jan 17 04:07:59 www syslogd 1.4.1: restart.



Expected results:
The post rotation script should run only once a week.
There should be only one line per week in a message log.


Additional info:

Comment 1 Elliot Lee 2004-02-24 16:24:48 UTC
Can you verify that the actual logfile rotation is happening as well?

Weekly rotation happens if:
1. The current weekday is before the weekday of the last rotation
2. More than a week has passed since the last rotation.

Comment 2 Silver Kuusk 2004-02-25 07:40:40 UTC
Actual logfile rotation is happening on every Sunday. But post 
scripts are running every day.

Comment 4 John Flanagan 2005-04-28 15:37:34 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-054.html