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
|
67
psacct.spec
67
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
|
||||
|
||||
Summary: Utilities for monitoring process activities
|
||||
Name: psacct
|
||||
Version: 6.5.5
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?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.init
|
||||
Source1: psacct.service
|
||||
Source2: psacct-logrotate.in
|
||||
Patch1: psacct-6.3.2-lastcomm_man.patch
|
||||
Patch2: acct-6.3.2-sa_manpage.patch
|
||||
Patch3: psacct-6.3.2-man-pages.patch
|
||||
Patch4: acct-6.5.5-direntry.patch
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Requires: /sbin/chkconfig /sbin/install-info
|
||||
BuildRequires: autoconf
|
||||
Requires: /sbin/install-info
|
||||
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
|
||||
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
|
||||
touch $RPM_BUILD_ROOT/var/account/pacct
|
||||
|
||||
# Create logrotate config file
|
||||
# create logrotate config file
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
sed -e 's|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} > $RPM_BUILD_ROOT/etc/logrotate.d/psacct
|
||||
|
||||
# Install initscript
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
|
||||
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/psacct
|
||||
# install systemd unit file
|
||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}
|
||||
|
||||
%if ! %{with_last}
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/last $RPM_BUILD_ROOT%{_mandir}/man1/last.1*
|
||||
%endif
|
||||
|
||||
%clean
|
||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%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 || :
|
||||
touch /var/account/pacct
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
if [ $1 -eq 0 ]; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload psacct.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop psacct.service > /dev/null 2>&1 || :
|
||||
|
||||
/sbin/install-info --delete %{_infodir}/accounting.info %{_infodir}/dir || :
|
||||
/sbin/service psacct stop > /dev/null 2>&1
|
||||
/sbin/chkconfig --del psacct
|
||||
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
|
||||
%defattr(-,root,root,-)
|
||||
%doc README COPYING
|
||||
%dir /var/account
|
||||
/etc/rc.d/init.d/psacct
|
||||
%{_unitdir}/psacct.service
|
||||
%attr(0600,root,root) %ghost %config /var/account/pacct
|
||||
%attr(0644,root,root) %config(noreplace) /etc/logrotate.d/*
|
||||
/sbin/accton
|
||||
@ -116,6 +142,9 @@ fi
|
||||
%{_infodir}/accounting.info.gz
|
||||
|
||||
%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
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user