Logrotate not running

Mysteriously, logrotate stopped processing the apache logs automatically, causing huge log files to accumulate. This is on Ubuntu 9.10.

I could run logrotate fine from the command line, and when done so it correctly processed the apache logs.

To try to find out what was going on, I wanted to capture the output of logrotate when run by cron, so I edited /etc/cron.daily/logrotate to look like this:

/usr/sbin/logrotate -v  /etc/logrotate.conf  > /root/logrotate.log 2>&1
#/usr/sbin/logrotate /etc/logrotate.conf

Bizarrely this made logrotate work, including for apache. Swapping the commands back breaks it again!

For the record, here is /etc/logrotate.d/apache

/var/log/apache2/*.log {
#       weekly
        size 500M
        missingok
        rotate 52
        compress
        dateext
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        prerotate
                webalizer
        endscript
        postrotate
                if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
                        /etc/init.d/apache2 reload > /dev/null
                fi
        endscript
}

Home | More stuff | Octad of the week