On 2017-02-14 13:32, Jacek Konieczny wrote:
I am not happy with crond running under systemd. The same could be done
with systemd timers, but we should keep compatibility with old systems.

I guess, I sent the mail too early, as now I have a bit better idea how
it could look like.

A new package: systemd-cronjobs
(pseudo-spec)

Provides: cronjobs
Obsoletes: crondaemon

%post:
systemctl enable cronjobs.target

%postun
systemctl disable cronjobs.target

%files:
/lib/systemd/system/cronjobs.target
/lib/systemd/system/cronjob-hourly.timer
/lib/systemd/system/cronjob-hourly.service
/lib/systemd/system/cronjob-daily.timer
/lib/systemd/system/cronjob-daily.service
/lib/systemd/system/cronjob-weekly.timer
/lib/systemd/system/cronjob-weekly.service
/lib/systemd/system/cronjob-monthly.timer
/lib/systemd/system/cronjob-monthly.service

-----------------

Updated: systemd-units:
%files
+/etc/systemd/system/cronjobs.target.wants

------------------

Updated: cronie  (and other crondaemons)
+Provides: cronjobs
 Provides: crondaemon
 Obsoletes: systemd-cronjobs

-------------------

Updated: logrotate (and other packages providing their crontabs)
-Requires: crondaemon
+Requires: cronjobs

 %post
+%systemd_reload

 %files
 /etc/cron.d/logrotate
+/lib/systemd/system/cronjob-logrotate.timer
+/lib/systemd/system/cronjob-logrotate.service


The systemd unit dependencies would be:
cronjobs.target WantedBy multi-user.target
cronjob-*.timer WantedBy cronjobs.target

How it would work:

When systemd-cronjobs is not installed – exactly as it works now.
Scheduled task are run by crond.

Installing systemd-cronjobs would uninstall any crond, but would be
possible only if there is no package left which would Require:
crondaemon (meaning: no cronjob-*.timer yet).

When systemd-cronjobs is installed scheduled tasks would be run from
systemd instead of crond.

Why it is better:
– no crond service running – one process less
– no unnecessary shell processes when a single executable is to be run
– no login session created (lots of PAM and systemd logs) when not necessary

What I am not sure yet:
– is 'Provides: cronjobs' and 'Name: systemd-cronjobs' any good?
– do we still need to care about crond, or should we just migrate
  everything to systemd timers?

Jacek
_______________________________________________
pld-devel-en mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en

Reply via email to