diff --git a/and.service b/and.service index 5bbf0a4..67a706d 100644 --- a/and.service +++ b/and.service @@ -3,7 +3,11 @@ Description=auto nice daemon After=syslog.target [Service] -ExecStart=/usr/sbin/and +Type=forking +EnvironmentFile=/etc/sysconfig/and +ExecStart=/usr/sbin/and $AND_FLAGS +StandardOutput=syslog +StandardError=syslog [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/and.spec b/and.spec index ccd7bbf..1363ee1 100644 --- a/and.spec +++ b/and.spec @@ -1,6 +1,6 @@ Name: and Version: 1.2.2 -Release: 11%{?dist} +Release: 13%{?dist} Summary: Auto nice daemon License: GPLv2 @@ -20,6 +20,21 @@ Provides: and-sysvinit = %{version}-%{release} Obsoletes: and-units < %{version}-%{release} Provides: and-units = %{version}-%{release} +BuildRequires: systemd-units + +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + +provides: and-sysvinit = %{version}-%{release} +Obsoletes: and-sysvinit < 1.2.2-11 + +provides: and-units = %{version}-%{release} +Obsoletes: and-units < 1.2.2-11 + + +Buildroot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n) + %description The auto nice daemon renices and even kills jobs according to their CPU time, owner, and command name. This is especially useful on production machines with @@ -52,18 +67,26 @@ make PREFIX=%{buildroot}%{_prefix} \ mkdir -p %{buildroot}%{_sysconfdir}/sysconfig install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/and -mkdir -p %{buildroot}/lib/systemd/system -install -p -m 0644 %{SOURCE2} %{buildroot}/lib/systemd/system +mkdir -p %{buildroot}%{_unitdir} +install -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir} %clean rm -rf %{buildroot} %post -/usr/bin/systemd-install --realize=minimal enable amd.service >/dev/null 2>&1 || : +if [ $1 -eq 1 ]; then + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi %preun -if [$1 -eq ß ]; then - /usr/bin/system-install --realize disable amd.service &1 || : +if [ $1 -eq 1 ]; then + /bin/systemctl --no-reload disable and.service >/dev/null 2>&1 || : + /bin/systemctl stop and.service >/dev/null 2>&1 || : +fi + +%postun +if [ $0 -en 0 ]; then + /bin/systemctl try-restart and.service >/dev/null 2>&1 || : fi %files @@ -74,16 +97,22 @@ fi %{_sbindir}/* %{_mandir}/man5/*.gz %{_mandir}/man8/*.gz -/lib/systemd/system/and.service +%{_unitdir}/and.service %changelog +* Wed Jun 15 2011 Jochen Schmitt 1.2.2-13 +- Rework and.service to fix #713432 + +* Thu Mar 31 2011 Jochen Schmitt 1.2.2-12 +- Rework for systemd + * Mon Feb 07 2011 Fedora Release Engineering - 1.2.2-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild -* Sun Nov 28 2010 Jochen Schmitt - 1.2.2-10 +* Sun Nov 28 2010 Jochen Schmitt 1.2.2-10 - Remove SysVInit support -* Sun Jul 18 2010 Jochen Schmitt - 1.2.2-9 +* Sun Jul 18 2010 Jochen Schmitt 1.2.2-9 - Try to add systemd support * Fri Jul 24 2009 Fedora Release Engineering - 1.2.2-8