logrotate cronjob /etc/cron.daily/logrotate throws errors when it is executed for the first time because it expects status file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
logrotate (Ubuntu) |
Fix Released
|
Medium
|
Reinhard Tartler |
Bug Description
Binary package hint: logrotate
The cronjob /etc/cron.
#!/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/
/etc/cron.
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
ProcVersionSign
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
tags: | added: patch |
Changed in logrotate (Ubuntu): | |
status: | New → Confirmed |
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.