diff --git a/README.md b/README.md index 75ba69f..a914ae4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # 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. + diff --git a/systemd-cron-1.5.17-cron-failure-disable-DynamicUser.patch b/systemd-cron-1.5.17-cron-failure-disable-DynamicUser.patch new file mode 100644 index 0000000..c58f1d5 --- /dev/null +++ b/systemd-cron-1.5.17-cron-failure-disable-DynamicUser.patch @@ -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 diff --git a/systemd-cron-crontab b/systemd-cron-crontab new file mode 100644 index 0000000..aac4a53 --- /dev/null +++ b/systemd-cron-crontab @@ -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 diff --git a/systemd-cron-sysusers.conf b/systemd-cron-sysusers.conf new file mode 100644 index 0000000..be3c0eb --- /dev/null +++ b/systemd-cron-sysusers.conf @@ -0,0 +1,2 @@ +g crontab - - + diff --git a/systemd-cron.spec b/systemd-cron.spec new file mode 100644 index 0000000..592a997 --- /dev/null +++ b/systemd-cron.spec @@ -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 +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 1.5.17-2mamba +- workaround cron-failure not sending email by unsetting DynamicUser=yes + +* Fri Mar 05 2021 Silvan Calarco 1.5.17-1mamba +- package created using the webbuild interface