logrotate cronjob /etc/cron.daily/logrotate throws errors when it is executed for the first time because it expects status file

Bug #785670 reported by Rorschach
50
This bug affects 7 people
Affects Status Importance Assigned to Milestone
logrotate (Ubuntu)
Medium
Reinhard Tartler

Bug Description

Binary package hint: logrotate

The cronjob /etc/cron.daily/logrotate looks like this:

#!/bin/sh

# Clean non existent log file entries from status file
cd /var/lib/logrotate
head -1 status > status.clean
sed 's/"//g' status | while read logfile date
do
    [ -e "$logfile" ] && echo "\"$logfile\" $date"
done >> status.clean
mv status.clean status

test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf

As you can see it expects the file /var/lib/logrotate/status to be present. If it's not the cronjob throws an error-message:

/etc/cron.daily/logrotate:
head: cannot open `status' for reading: No such file or directory
sed: can't read status: No such file or directory

But this file is just present AFTER logrotate has been run at least once. This means this cronjob always throws an error the first time logrotate is run.

I wrote a little patch for the cronjob to fix this problem.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: logrotate 3.7.8-6ubuntu3
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic x86_64
Architecture: amd64
Date: Fri May 20 11:49:03 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110426)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: logrotate
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Rorschach (r0rschach) wrote :
tags: added: patch
Revision history for this message
annunaki2k2 (russell-knighton) wrote :

Yup, can confirm this as a bug - I've had it too.

Please can you fix this. Your day-to-day casual desktop users may not care (or even notice) this bug, but your server based users do. Such a trial issue and a fix already posted - should have been rolled out by now. How long will this stay open for and not acted upon I wonder...

I don't wish to rant, but this is the first installation of 11.04 I've performed, and I've encountered 4 bugs already... not impressed.

Revision history for this message
Jo Liss (joliss42) wrote :

This is actually a bit of a hassle for cloud users who regularly deploy servers on top of fresh vanilla Ubuntu images, because it means that every time you deploy, you get an error notice emailed from cron.

Changed in logrotate (Ubuntu):
status: New → Confirmed
Revision history for this message
Derek White (d-man97) wrote :

I second it being an annoyance for cloud users.

Revision history for this message
Derek White (d-man97) wrote :

And, I can confirm the patch works. Even able to apply it from a script during instance startup.

-Derek

Revision history for this message
Reinhard Tartler (siretart) wrote :

I've uploaded a fix to oneiric, but it's waiting for approval.

Changed in logrotate (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Reinhard Tartler (siretart)
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package logrotate - 3.7.8-6ubuntu5

---------------
logrotate (3.7.8-6ubuntu5) oneiric; urgency=low

  * cron.daily: ensure that the status file exists to avoid error messages
    in cron mail. LP: #785670
 -- Reinhard Tartler <email address hidden> Tue, 04 Oct 2011 18:23:34 +0200

Changed in logrotate (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Janne (jannehson51) wrote :

Seems to be a problem in 10.04 LTS also.
Please fix this!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers