Why the first rotation is skipped after updating to logrotate-3.8.6-12?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7
  • logrotate-3.8.6-12.el7.x86_64

Issue

  • Why the first rotation is skipped after updating to logrotate-3.8.6-12?

Resolution

  • This is a known bug. Please refer to Bug 1393247 . It hasn't been fixed yet.
  • Workaround
# cp -a /var/lib/logrotate.status.rpmsave /var/lib/logrotate/logrotate.status

Root Cause

  • %pre script in SPEC file copies logrotate.status file from old location to new location. But after that /var/lib/logrotate/logrotate.status
    is copied from RPM despite %config(noreplace), because in a previous version of the package didn't have that file.

Diagnostic Steps

  • /etc/cron.daily/logrotate provided by logrotate-3.8.6-12
#!/bin/sh

/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf   <-----------
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
  • /etc/cron.daily/logrotate provided by logrotate-3.8.6-7
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf  <-----------
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments