workaround cron-failure not sending email by unsetting DynamicUser=yes [release 1.5.17-2mamba;Thu Mar 25 2021]

This commit is contained in:
Silvan Calarco 2024-01-05 18:18:47 +01:00
parent f2962c4e25
commit e032101f70
5 changed files with 171 additions and 0 deletions

View File

@ -1,2 +1,5 @@
# systemd-cron # systemd-cron
systemd units to provide cron daemon functionality by running scripts in cron directories.
The crontabs are automaticaly translated using (/usr)/lib/systemd/system-generators/systemd-crontab-generator.

View File

@ -0,0 +1,9 @@
--- systemd-cron-1.5.17/src/units/cron-failure@.service.in.orig 2021-03-25 16:47:55.125066343 +0100
+++ systemd-cron-1.5.17/src/units/cron-failure@.service.in 2021-03-25 16:48:00.602163196 +0100
@@ -8,5 +8,5 @@
[Service]
Type=oneshot
ExecStart=@libdir@/@package@/mail_on_failure %i
-DynamicUser=yes
+#DynamicUser=yes
Group=systemd-journal

10
systemd-cron-crontab Normal file
View File

@ -0,0 +1,10 @@
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root nice -n 19 run-parts /etc/cron.hourly
02 4 * * * root nice -n 19 run-parts /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts /etc/cron.monthly

View File

@ -0,0 +1,2 @@
g crontab - -

147
systemd-cron.spec Normal file
View File

@ -0,0 +1,147 @@
Name: systemd-cron
Version: 1.5.17
Release: 2mamba
Summary: systemd units to provide cron daemon functionality by running scripts in cron directories
Group: System/Servers
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://github.com/systemd-cron
Source: https://github.com/systemd-cron/systemd-cron.git/v%{version}/systemd-cron-%{version}.tar.bz2
Source1: systemd-cron-sysusers.conf
Source2: systemd-cron-crontab
Patch0: systemd-cron-1.5.17-cron-failure-disable-DynamicUser.patch
License: MIT
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: ldconfig
## AUTOBUILDREQ-END
%systemd_requires
Requires: debianutils
Requires: postfix
Provides: vixie-cron
Obsoletes: vixie-cron <= 4.1-3mamba
%description
systemd units to provide cron daemon functionality by running scripts in cron directories.
The crontabs are automaticaly translated using (/usr)/lib/systemd/system-generators/systemd-crontab-generator.
%debug_package
%prep
%setup -q
sed -i "s|/usr/bin/touch|/bin/touch|" src/units/cron-update.service.in
%patch0 -p1
%build
./configure \
--prefix=%{_prefix} \
--unitdir=%{_unitdir} \
--generatordir=%{_systemdgeneratordir} \
--confdir=%{_sysconfdir} \
--enable-minutely --enable-quarterly --enable-semi_annually --enable-yearly \
--enable-persistent --enable-setgid --enable-randomized-delay
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
install -d %{buildroot}%{_sysconfdir}/cron.{d,boot,minutely,hourly,daily,weekly,monthly,quarterly,semi-annually,yearly}
install -d -m0775 %{buildroot}/var/spool/cron
install -D -m0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/systemd-cron.conf
install -D -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/crontab
install -d -m0755 %{buildroot}%{_presetdir}
echo "enable cron.target" > %{buildroot}%{_presetdir}/50-systemd-cron.preset
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
%sysusers_create_package systemd-cron %{SOURCE1}
:
%post
touch /run/crond.reboot
touch /run/crond.bootdir
%systemd_post cron.target
:
%preun
%systemd_preun cron.target
:
%postun
%systemd_postun cron.target
:
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/crontab
%dir %{_sysconfdir}/cron.boot
%dir %{_sysconfdir}/cron.d
%dir %{_sysconfdir}/cron.minutely
%dir %{_sysconfdir}/cron.hourly
%dir %{_sysconfdir}/cron.daily
%dir %{_sysconfdir}/cron.weekly
%dir %{_sysconfdir}/cron.monthly
%dir %{_sysconfdir}/cron.quarterly
%dir %{_sysconfdir}/cron.semi-annually
%dir %{_sysconfdir}/cron.yearly
%{_bindir}/crontab
%{_unitdir}/cron-boot.service
%{_unitdir}/cron-boot.target
%{_unitdir}/cron-boot.timer
%{_unitdir}/cron-daily.service
%{_unitdir}/cron-daily.target
%{_unitdir}/cron-daily.timer
%{_unitdir}/cron-failure@.service
%{_unitdir}/cron-hourly.service
%{_unitdir}/cron-hourly.target
%{_unitdir}/cron-hourly.timer
%{_unitdir}/cron-minutely.service
%{_unitdir}/cron-minutely.target
%{_unitdir}/cron-minutely.timer
%{_unitdir}/cron-monthly.service
%{_unitdir}/cron-monthly.target
%{_unitdir}/cron-monthly.timer
%{_unitdir}/cron-quarterly.service
%{_unitdir}/cron-quarterly.target
%{_unitdir}/cron-quarterly.timer
%{_unitdir}/cron-semi-annually.service
%{_unitdir}/cron-semi-annually.target
%{_unitdir}/cron-semi-annually.timer
%{_unitdir}/cron-update.path
%{_unitdir}/cron-update.service
%{_unitdir}/cron-weekly.service
%{_unitdir}/cron-weekly.target
%{_unitdir}/cron-weekly.timer
%{_unitdir}/cron-yearly.service
%{_unitdir}/cron-yearly.target
%{_unitdir}/cron-yearly.timer
%{_unitdir}/cron.target
%{_presetdir}/50-systemd-cron.preset
%dir %{_prefix}/lib/systemd-cron
%{_prefix}/lib/systemd-cron/boot_delay
%attr(2755,root,crontab) %{_prefix}/lib/systemd-cron/crontab_setgid
%{_prefix}/lib/systemd-cron/mail_on_failure
%{_prefix}/lib/systemd-cron/remove_stale_stamps
%{_systemdgeneratordir}/systemd-crontab-generator
%{_sysusersdir}/systemd-cron.conf
%attr(0770,root,crontab) %dir /var/spool/cron
%{_mandir}/man1/crontab.1*
%{_mandir}/man5/anacrontab.5*
%{_mandir}/man5/crontab.5*
%{_mandir}/man7/systemd.cron.7*
%{_mandir}/man8/systemd-crontab-generator.8*
%doc LICENSE
%changelog
* Thu Mar 25 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.5.17-2mamba
- workaround cron-failure not sending email by unsetting DynamicUser=yes
* Fri Mar 05 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.5.17-1mamba
- package created using the webbuild interface