- Fix the logrotate script and split its template to a separate file.

(Michal Schmidt patch, thanks)
This commit is contained in:
Ivana Varekova 2010-01-28 11:41:10 +00:00
parent b9bd914a98
commit 71203a44c7
2 changed files with 22 additions and 25 deletions

15
psacct-logrotate.in Normal file
View File

@ -0,0 +1,15 @@
# Logrotate file for psacct RPM
%{accounting_logdir}/pacct {
compress
delaycompress
notifempty
daily
rotate 31
create 0600 root root
postrotate
if /etc/init.d/psacct status >/dev/null 2>&1; then
%{_sbindir}/accton %{accounting_logdir}/pacct
fi
endscript
}

View File

@ -12,12 +12,13 @@
Summary: Utilities for monitoring process activities
Name: psacct
Version: 6.5.1
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
Group: Applications/System
URL: ftp://ftp.gnu.org/pub/gnu/acct/
Source: ftp://ftp.gnu.org/pub/gnu/acct/acct-%{version}.tar.gz
Source1: psacct.init
Source2: psacct-logrotate.in
# This dumb patch breaks FHS 2.2 compliance, so it is disabled now except
# in 7.x builds. Do not use it in new products.
Patch0: acct-6.3.2-config.patch
@ -99,30 +100,7 @@ touch $RPM_BUILD_ROOT%{accounting_logdir}/pacct
# Create logrotate config file
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
cat > $RPM_BUILD_ROOT/etc/logrotate.d/psacct <<EOF
# Logrotate file for psacct RPM
%{accounting_logdir}/pacct {
#prerotate loses accounting records, let's no
# prerotate
# /etc/init.d/psacct status;
# STATUS=\$?
# %{_sbindir}/accton
# endscript
compress
delaycompress
notifempty
daily
rotate 31
create 0600 root root
postrotate
if [ \$STATUS -eq 0 ]
then
%{_sbindir}/accton %{accounting_logdir}/pacct
fi
endscript
}
EOF
sed -e 's|%%{accounting_logdir}|%{accounting_logdir}|g;s|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} > $RPM_BUILD_ROOT/etc/logrotate.d/psacct
# Install initscript
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
@ -184,6 +162,10 @@ fi
%{_infodir}/accounting.info.gz
%changelog
* Wed Jan 28 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 6.5.1-5
- Fix the logrotate script and split its template to a separate file.
(Michal Schmidt patch, thanks)
* Thu Jan 28 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 6.5.1-4
- fix the logrotate change