systemd init script (replacement)

This commit is contained in:
Marcela Mašláňová 2010-11-30 13:28:14 +01:00
parent fb9263a86c
commit a16f9f1e98
4 changed files with 26 additions and 3 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ test.pl
at_3.1.11.orig.tar.gz at_3.1.11.orig.tar.gz
at_3.1.12.orig.tar.gz at_3.1.12.orig.tar.gz
pam_atd pam_atd
/atd.systemd

23
at.spec
View File

@ -6,7 +6,7 @@
Summary: Job spooling tools Summary: Job spooling tools
Name: at Name: at
Version: %{major_ver} Version: %{major_ver}
Release: 5%{dist} Release: 6%{dist}
License: GPLv2+ License: GPLv2+
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://ftp.debian.org/debian/pool/main/a/at URL: http://ftp.debian.org/debian/pool/main/a/at
@ -16,6 +16,7 @@ Source1: pam_atd
Source2: atd.init Source2: atd.init
Source3: atd.sysconf Source3: atd.sysconf
Source4: 56atd Source4: 56atd
Source5: atd.systemd
Patch1: at-3.1.12-makefile.patch Patch1: at-3.1.12-makefile.patch
Patch2: at-3.1.12-opt_V.patch Patch2: at-3.1.12-opt_V.patch
@ -38,7 +39,10 @@ BuildRequires: pam-devel
Conflicts: crontabs <= 1.5 Conflicts: crontabs <= 1.5
# No, I'm not kidding # No, I'm not kidding
BuildRequires: smtpdaemon BuildRequires: smtpdaemon
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # systemd compatibility
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description %description
At and batch read commands from standard input or from a specified At and batch read commands from standard input or from a specified
@ -116,6 +120,10 @@ install -m 755 %{SOURCE3} %{buildroot}/etc/sysconfig/atd
mkdir -p %{buildroot}/%{_libdir}/pm-utils/sleep.d/ mkdir -p %{buildroot}/%{_libdir}/pm-utils/sleep.d/
install -m 755 %{SOURCE4} %{buildroot}/%{_libdir}/pm-utils/sleep.d/56atd install -m 755 %{SOURCE4} %{buildroot}/%{_libdir}/pm-utils/sleep.d/56atd
# install systemd initscript
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/lib/systemd/system/atd.service
# remove unpackaged files from the buildroot # remove unpackaged files from the buildroot
rm -r %{buildroot}%{_prefix}/doc rm -r %{buildroot}%{_prefix}/doc
@ -131,16 +139,23 @@ chmod 600 %{_localstatedir}/spool/at/.SEQ
chown daemon:daemon %{_localstatedir}/spool/at/.SEQ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ
# must be in chkconfig on # must be in chkconfig on
/sbin/chkconfig --add atd /sbin/chkconfig --add atd
# systemd
/bin/systemctl enable atd.service >/dev/null 2>&1 || :
%preun %preun
if [ "$1" = "0" ] ; then if [ "$1" = "0" ] ; then
/sbin/service atd stop >/dev/null 2>&1 ||: /sbin/service atd stop >/dev/null 2>&1 ||:
/sbin/chkconfig --del atd /sbin/chkconfig --del atd
# systemd
/bin/systemctl disable atd.service >/dev/null 2>&1 || :
/bin/systemctl stop atd.service > /dev/null 2>&1 || :
fi fi
%postun %postun
if [ "$1" -ge "1" ]; then if [ "$1" -ge "1" ]; then
/sbin/service atd condrestart >/dev/null 2>&1 ||: /sbin/service atd condrestart >/dev/null 2>&1 ||:
# systemd
/bin/systemctl try-restart atd.service >/dev/null 2>&1 || :
fi fi
%files %files
@ -161,8 +176,12 @@ fi
%{_bindir}/atq %{_bindir}/atq
%attr(4755,root,root) %{_bindir}/at %attr(4755,root,root) %{_bindir}/at
%attr(0755,root,root) %{_libdir}/pm-utils/sleep.d/56atd %attr(0755,root,root) %{_libdir}/pm-utils/sleep.d/56atd
%attr(0644,root,root) /lib/systemd/system/atd.service
%changelog %changelog
* Tue Nov 30 2010 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.12-6
- 617320 systemd init script replacement
* Mon Mar 15 2010 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.12-5 * Mon Mar 15 2010 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.12-5
- 568222 interrupted 'at' job creates empty job for non-root - 568222 interrupted 'at' job creates empty job for non-root

View File

@ -34,10 +34,11 @@ start() {
[ -x $exec ] || exit 5 [ -x $exec ] || exit 5
[ -f $config ] || exit 6 [ -f $config ] || exit 6
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
daemon $exec $OPTS daemon $exec $OPTS && success || failure
retval=$? retval=$?
echo echo
[ $retval -eq 0 ] && touch $lockfile [ $retval -eq 0 ] && touch $lockfile
return $retval
} }
stop() { stop() {
@ -51,6 +52,7 @@ stop() {
retval=$? retval=$?
echo echo
[ $retval -eq 0 ] && rm -f $lockfile [ $retval -eq 0 ] && rm -f $lockfile
return $retval
} }
restart() { restart() {

View File

@ -3,3 +3,4 @@ b117781fd68e393443b2a8e478c7c22f atd.init
ac1471fe22f63f666dc7d31173f47ea0 atd.sysconf ac1471fe22f63f666dc7d31173f47ea0 atd.sysconf
1e67991776148fb319fd77a2e599a765 at_3.1.12.orig.tar.gz 1e67991776148fb319fd77a2e599a765 at_3.1.12.orig.tar.gz
000d2f30379d2bf8af09f51416e863ec pam_atd 000d2f30379d2bf8af09f51416e863ec pam_atd
0e763d641e33ad468bd8f5ef05da395a atd.systemd