by otterley · 8y ago · 0 comments
[1] https://www.freedesktop.org/software/systemd/man/systemd.tim...
simpler to the point that you need whole libraries and helpers (such as https://www.freeformatter.com/cron-expression-generator-quar...) to convert from readable time to cron specifications ?
Meanwhile, sd is just
[Timer]
OnCalendar=weeklyBut you loose the main point, that is consistency of syntax. Nowadays thanks to systemd I can use the exact same syntax to configure my daemons, my network, my DNS resolver, my timers, my locale, etc etc. The mental burden is way lighter than with the traditional UNIX toolset.
You only "need" to read the man page - the same as with systemd (asuming it still uses man, and not its own custom help viewer). If you'd read said man page, you'd know you can just type @weekly, for such a simple time period.
What's that mean though? It's entirely meaningless unless you, what's that, check the manual. Or what if you want it to run on another day? What's that? Check the manual? Sound familiar?
In particular: which day of the week, and at what time?
cron expressions have about as much learning curve as ISO-8601, and are otherwise unambiguous once you know how to read them. systemd's time specifications look like they're full of special cases:
https://www.freedesktop.org/software/systemd/man/systemd.tim...
?
Cron, busybox and friends are still good things to master.
don't you ? my phone from 2013 runs systemd and wayland.
It has made my life miserable more than once, but looking at how many hours I've spent working around it, I can see why consulting companies love it.
It's also not just a matter of time before everyone switches over, since there's been backlash against systemd and competing projects have either started up, or gained more momentum (except for upstart, obviously!).
One of those alternatives is the "dmd" init system, which seems to have been around for a while but has recently been rebranded as "GNU Shepherd". Shepherd follows the "do one thing well" philosophy, so it only manages daemons. If shepherd users (e.g. GuixSD) want to run scheduled commands, they'll need another program to do that (i.e. a cron daemon), and GNU Mcron looks like a sensible choice since all of these things are configured using Guile Scheme.
As a side rant: I dislike your use of the term "legacy" for something which is actively maintained and gaining users. Usually "legacy" refers to something which is either abandoned, or where the maintainers recommend against adopting it (e.g. "that's our legacy API, use this other one instead"). I think the word "traditional" would work, when talking about cron in general; although Mcron in particular doen't look like a particularly traditional cron (since its selling point is using Scheme for config!)
But seriously though, it solves a lot of problems around dependency and device management, error handling, logging, timer management, and so forth. To be sure, it has a steep learning curve, but I've found the effort invested to be well worth it.
You mean, besides all the highly-available systems on which it currently runs? Since it's already part of the two most-used distributions in the world, it's fair to say that it's gotten sufficient exercise such that all of the serious kinks have been worked out by now.
Also, I'm not sure what you mean by having to "update all the time." Sure, systemd gets occasional security/bugfix patches, but so did sysvinit. And like sysvinit, systemd is hot-reloadable, so it's never been a problem in practice.
As for the timer functionality in systemd, the configuration language is, IMO, far easier to understand. It doesn't get any easier than:
[Timer]
OnCalendar=weekly
or: [Timer]
OnStartupSec=0
OnActiveSec=1htake oddjobd for example, which supplants pam_mkhomedir.so in creating a users home directory on first login. oddjob is its own standalone daemon running constantly, while pam_mkhomedir is invoked only as necessary. oddjob needs dbus and systemd to complete what in many systems is just a simple mkhomedir && chown user:grp $homedir. its now fully dependent on the most fundamental building blocks of your OS to do one simple thing.
this also assumes the user doesnt have a home directory...which...many do.
in most commercial infrastructure if you suggest installing oddjobd to handle the potential for a user to log in without their home youll be laughed out of the chat. oddjobd forces organizations back into the 1980s and NIS based implementations of federated authentication where you had to go to a new user machine, or an account creation machine first if you dont want to run yet another idle daemon on your machine
I don't see any of that citation. Or evidence.
Just because you deem something overly complicated doesn't mean that it doesn't serve a practical purpose.
You don't want to go to all the effort to spin up a CPU core to schedule a (cron) process thread, just to find out it has no work to do. Ideally, if you're going to check the time at all, you just want it done in one thread running on one core, so that the rest of the cores can stay asleep and you never have to spend energy context-switching when idle.
That being said, systemd isn't quite the right architecture for getting down to a "tickless everything" system. That'd be something more like WinNT's kernel timer object API, where the kernel sends an event to your window's or service's message inbox to wake you up when the timer is done; or macOS's "Grand Central Dispatch", where any native code (including non-Foundation POSIX code!) can pass scheduling control of any async block through a Mach trap over to one central scheduling process, which coalesces both timers and the runtimes of async events in general so that all background CPU activity happens in bursts with idles in between.
Right now, I am doing this all with a mess of shell scripts (flock + logger + echo calls + pgrep). This is fragile and ugly.
Since systemd provides all of the above easily, a better approach will be one-off systemd jobs. In this case, my crontab entries would be a trivial -- "1 3 * * * root systemctl start cronjob1". This only requires scheduling functionality -- background execution, env vars, email notification and other things no longer matter.
From there, it is just one small step to move scheduling into the init process itself -- after all, compared to what other things init does, scheduling is both simple and safe.
> I can't imagine using a legacy solution anymore.
Good thing sane people are improving on the legacy space then, with mcron--the subject of the link before someone had to mention SystemD--being a case in point.