From 33de87e741467022f88c045ee096a896bec956f2 Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Thu, 11 Apr 2013 20:56:49 +0200 Subject: [PATCH] - Logfile creation in the systemd unit file (#918132) --- accton-create | 3 +++ psacct.service | 7 ++++--- psacct.spec | 11 ++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100755 accton-create diff --git a/accton-create b/accton-create new file mode 100755 index 0000000..0478ebc --- /dev/null +++ b/accton-create @@ -0,0 +1,3 @@ +#!/bin/sh +ACCTFILE=/var/account/pacct +[ ! -r $ACCTFILE ] && touch $ACCTFILE && chmod 600 $ACCTFILE diff --git a/psacct.service b/psacct.service index 8aece6d..832c0c5 100644 --- a/psacct.service +++ b/psacct.service @@ -1,12 +1,13 @@ [Unit] Description=Kernel process accounting After=syslog.target -ConditionPathExists=/var/account/pacct +ConditionPathExists=/var/account [Service] Type=oneshot -ExecStart=/sbin/accton /var/account/pacct -ExecStop=/sbin/accton off +ExecStartPre=/usr/libexec/psacct/accton-create +ExecStart=/usr/sbin/accton /var/account/pacct +ExecStop=/usr/sbin/accton off RemainAfterExit=yes [Install] diff --git a/psacct.spec b/psacct.spec index b3e74fc..25017ac 100644 --- a/psacct.spec +++ b/psacct.spec @@ -4,13 +4,14 @@ Summary: Utilities for monitoring process activities Name: psacct Version: 6.6.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ 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.service Source2: psacct-logrotate.in +Source3: accton-create Patch1: psacct-6.3.2-lastcomm_man.patch Patch2: acct-6.3.2-sa_manpage.patch Patch3: psacct-6.3.2-man-pages.patch @@ -76,6 +77,10 @@ sed -e 's|%%{_bindir}|%{_bindir}|g' -e 's|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} mkdir -p %{buildroot}%{_unitdir} install -m 644 %{SOURCE1} %{buildroot}%{_unitdir} +# install accton-create script +install -d -m 0755 %{buildroot}%{_libexecdir}/psacct +install -m 755 %{SOURCE3} %{buildroot}%{_libexecdir}/psacct/ + %if ! %{with_last} rm -f %{buildroot}%{_bindir}/last %{buildroot}%{_mandir}/man1/last.1* %endif @@ -117,6 +122,7 @@ fi %{_sbindir}/sa %{_sbindir}/dump-utmp %{_sbindir}/dump-acct +%{_libexecdir}/psacct/accton-create %{_bindir}/ac %if %{with_last} %{_bindir}/last @@ -134,6 +140,9 @@ fi %{_infodir}/accounting.info.gz %changelog +* Thu Apr 11 2013 Jaromir Capik - 6.6.1-2 +- Logfile creation in the systemd unit file (#918132) + * Tue Apr 09 2013 Jaromir Capik - 6.6.1-1 - Update to 6.6.1 - Fixing bogus dates in the changelog