Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#20863 - [logrotate] Issue. $1 in prerotate is broke

Attached to Project: Arch Linux
Opened by Joe H (joehendew) - Thursday, 16 September 2010, 14:36 GMT
Last edited by Allan McRae (Allan) - Monday, 25 October 2010, 07:26 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Aaron Griffin (phrakture)
Allan McRae (Allan)
Architecture i686
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Running version i686 arch 2010.05
"Linux 2.6.34-ARCH #1 SMP PREEMPT Mon Jul 5 21:03:38 UTC 2010 i686 Intel(R) Core(TM)2 Duo CPU E7400 @ 2.80GHz GenuineIntel GNU/Linux"

Package: logrotate-3.7.8-1

In an older version of logrotate i can use the $1 variable in the
prerotate section of the logrotate.conf or and files listed in the
logrotate.d directory. now if list multiple files and use the $1
variable the $1 does not list the next file in the list.

It seems this is an issue with the prerotate section due to you
can rotate the files not using the prerotate and the files are listed to
be rotated.
Here's the commands i use to show the rotate:

logrotate --debug --force /etc/logrotate.conf


Here's the file contents with the prerotate script.

###############
/var/log/auth.log /var/log/crond.log /var/log/daemon.log /var/log/kernel.log
/var/log/lpr.log /var/log/mail.log /var/log/news.log /var/log/user.log
/var/log/debug.log /var/log/errors.log /var/log/messages.log /var/log/iptables.log
/var/log/pacman.log /var/log/network.log
{
## DO NOT COMPRESS.. I like gzip better
nocompress

## Create the new files as root with rw only
create 0660 root log

## Rotate Weekly
weekly

## if log is missing ignore
nomissingok

## Do not keep any logs (homegrown script will take care of this)
rotate 0

### Only run prerotate and postrotate scripts after all files are rotated
sharedscripts

prerotate
logf=$1
logf=`perl -e '$var = $ARGV[0]; $var =~ s/\n//g; print $var;' $logf`
#logf=`echo $logf | sed 's/ +$//' | sed 's/\n//'`
nlogf=$logf.`date '+%Y-%m-%d_%H-%M-%S'`.log
echo "$nlogf"
stor=/var/log/old_logs
/bin/mv $logf $nlogf
/bin/gzip -3 $nlogf
/bin/mv ${nlogf}.gz $stor
/bin/touch $logf
/bin/chmod 0660 $logf
/bin/chown root:log $logf
endscript

postrotate
/bin/kill -HUP `cat /var/run/syslog-ng.pid 2>/dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/samba/*.pid 2>/dev/null` 2>/dev/null || true
/bin/kill -HUP `cat /var/run/named/named.pid 2>/dev/null` 2>/dev/null || true
/bin/kill -HUP `cat /var/run/cups.pid 2>/dev/null` 2>/dev/null || true
endscript
}

###############



Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
This task depends upon

Closed by  Allan McRae (Allan)
Monday, 25 October 2010, 07:26 GMT
Reason for closing:  Fixed
Additional comments about closing:  Assuming fixed. No response from submitter.
Comment by Allan McRae (Allan) - Thursday, 30 September 2010, 15:53 GMT
Try logrotate-3.7.9-1 in [testing]. I believe that fixes this issue.
Comment by Allan McRae (Allan) - Monday, 11 October 2010, 07:49 GMT
3.7.9-1 is in [core] now...

Loading...