Migration to systemd unit file
This commit is contained in:
parent
56253f0c61
commit
9831dcad95
13
psacct.service
Normal file
13
psacct.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Kernel process accounting
|
||||||
|
After=syslog.target
|
||||||
|
ConditionPathExists=/var/account/pacct
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/sbin/accton /var/account/pacct
|
||||||
|
ExecStop=/sbin/accton off
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
69
psacct.spec
69
psacct.spec
@ -1,25 +1,32 @@
|
|||||||
# Our /usr/bin/last is in the SysVInit packae
|
# Our /usr/bin/last is in the SysVInit package
|
||||||
%define with_last 0
|
%define with_last 0
|
||||||
|
|
||||||
Summary: Utilities for monitoring process activities
|
Summary: Utilities for monitoring process activities
|
||||||
Name: psacct
|
Name: psacct
|
||||||
Version: 6.5.5
|
Version: 6.5.5
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: ftp://ftp.gnu.org/pub/gnu/acct/
|
URL: ftp://ftp.gnu.org/pub/gnu/acct/
|
||||||
Source: ftp://ftp.gnu.org/pub/gnu/acct/acct-%{version}.tar.gz
|
Source: ftp://ftp.gnu.org/pub/gnu/acct/acct-%{version}.tar.gz
|
||||||
Source1: psacct.init
|
Source1: psacct.service
|
||||||
Source2: psacct-logrotate.in
|
Source2: psacct-logrotate.in
|
||||||
Patch1: psacct-6.3.2-lastcomm_man.patch
|
Patch1: psacct-6.3.2-lastcomm_man.patch
|
||||||
Patch2: acct-6.3.2-sa_manpage.patch
|
Patch2: acct-6.3.2-sa_manpage.patch
|
||||||
Patch3: psacct-6.3.2-man-pages.patch
|
Patch3: psacct-6.3.2-man-pages.patch
|
||||||
Patch4: acct-6.5.5-direntry.patch
|
Patch4: acct-6.5.5-direntry.patch
|
||||||
|
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
Requires: /sbin/install-info
|
||||||
Requires: /sbin/chkconfig /sbin/install-info
|
|
||||||
BuildRequires: autoconf
|
|
||||||
Requires: coreutils
|
Requires: coreutils
|
||||||
|
Requires(post): chkconfig
|
||||||
|
Requires(post): systemd-sysv
|
||||||
|
Requires(post): systemd-units
|
||||||
|
Requires(preun): systemd-units
|
||||||
|
Requires(postun): systemd-units
|
||||||
|
|
||||||
|
BuildRequires: autoconf
|
||||||
|
BuildRequires: systemd-units
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The psacct package contains several utilities for monitoring process
|
The psacct package contains several utilities for monitoring process
|
||||||
@ -60,38 +67,57 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|||||||
mkdir -p $RPM_BUILD_ROOT/var/account
|
mkdir -p $RPM_BUILD_ROOT/var/account
|
||||||
touch $RPM_BUILD_ROOT/var/account/pacct
|
touch $RPM_BUILD_ROOT/var/account/pacct
|
||||||
|
|
||||||
# Create logrotate config file
|
# create logrotate config file
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||||
sed -e 's|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} > $RPM_BUILD_ROOT/etc/logrotate.d/psacct
|
sed -e 's|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} > $RPM_BUILD_ROOT/etc/logrotate.d/psacct
|
||||||
|
|
||||||
# Install initscript
|
# install systemd unit file
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
|
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||||
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/psacct
|
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}
|
||||||
|
|
||||||
%if ! %{with_last}
|
%if ! %{with_last}
|
||||||
rm -f $RPM_BUILD_ROOT%{_bindir}/last $RPM_BUILD_ROOT%{_mandir}/man1/last.1*
|
rm -f $RPM_BUILD_ROOT%{_bindir}/last $RPM_BUILD_ROOT%{_mandir}/man1/last.1*
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%clean
|
|
||||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
/sbin/chkconfig --add psacct
|
if [ $1 -eq 1 ] ; then
|
||||||
|
# Initial installation
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
/sbin/install-info %{_infodir}/accounting.info %{_infodir}/dir || :
|
/sbin/install-info %{_infodir}/accounting.info %{_infodir}/dir || :
|
||||||
touch /var/account/pacct
|
touch /var/account/pacct
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 -eq 0 ]; then
|
||||||
/sbin/install-info --delete %{_infodir}/accounting.info %{_infodir}/dir || :
|
# Package removal, not upgrade
|
||||||
/sbin/service psacct stop > /dev/null 2>&1
|
/bin/systemctl --no-reload psacct.service > /dev/null 2>&1 || :
|
||||||
/sbin/chkconfig --del psacct
|
/bin/systemctl stop psacct.service > /dev/null 2>&1 || :
|
||||||
|
|
||||||
|
/sbin/install-info --delete %{_infodir}/accounting.info %{_infodir}/dir || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%postun
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
if [ $1 -ge 1 ] ; then
|
||||||
|
# Package upgrade, not uninstall
|
||||||
|
/bin/systemctl try-restart psacct.service >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
%triggerun -- psacct < 6.5.5-3
|
||||||
|
# Save the current service runlevel info
|
||||||
|
# User must manually run systemd-sysv-convert --apply psacct
|
||||||
|
# to migrate them to systemd targets
|
||||||
|
%{_bindir}/systemd-sysv-convert --save psacct >/dev/null 2>&1 ||:
|
||||||
|
|
||||||
|
# Run these because the SysV package being removed won't do them
|
||||||
|
/sbin/chkconfig --del psacct >/dev/null 2>&1 || :
|
||||||
|
/bin/systemctl try-restart psacct.service >/dev/null 2>&1 || :
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%doc README COPYING
|
%doc README COPYING
|
||||||
%dir /var/account
|
%dir /var/account
|
||||||
/etc/rc.d/init.d/psacct
|
%{_unitdir}/psacct.service
|
||||||
%attr(0600,root,root) %ghost %config /var/account/pacct
|
%attr(0600,root,root) %ghost %config /var/account/pacct
|
||||||
%attr(0644,root,root) %config(noreplace) /etc/logrotate.d/*
|
%attr(0644,root,root) %config(noreplace) /etc/logrotate.d/*
|
||||||
/sbin/accton
|
/sbin/accton
|
||||||
@ -116,6 +142,9 @@ fi
|
|||||||
%{_infodir}/accounting.info.gz
|
%{_infodir}/accounting.info.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 29 2011 Jaromir Capik <jcapik@redhat.com> - 6.5.5-3
|
||||||
|
- Migration to systemd unit file
|
||||||
|
|
||||||
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.5.5-2
|
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.5.5-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user