8 ms·
Now that timers are baked into systemd[1], the days of cron and its cousins seem to be numbered. The systemd timer specification is pretty rich, and since it c
by otterley 9y ago
Now that timers are baked into systemd[1], the days of cron and its cousins seem to be numbered. The systemd timer specification is pretty rich, and since it can control any arbitrary systemd unit, I can't imagine using a legacy solution anymore.
[1] https://www.freedesktop.org/software/systemd/man/systemd.timer.html https://www.freedesktop.org/software/systemd/man/systemd.tim...
- userbinator 9y agoI'm not surprised. systemd reinventing and horribly overcomplicating things is nothing new.
- otterley 9y agoDo you have substantive feedback about the systemd timer implementation, or are you just here to shitpost?
- nimbius 9y agono, the poster is citing well documented historical evidence that systemd reinventions of traditional posix compliant unix/BSD/Linux services arrive as a horrendously complex mess of overcomplicated code. take 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
- wereHamster 9y ago> the poster is citing well documented historical evidence I don't see any of that citation. Or evidence.
- dig1 9y agoFor evidence, use the source Luke ;) systemd has plenty of reinvention evidences...
- userbinator 9y agoAnother memorable example is systemd's DNS resolver which somehow has to involve XML parsing/unparsing just for a simple hostname lookup: https://lists.dns-oarc.net/pipermail/dns-operations/2016-June/014966.html https://lists.dns-oarc.net/pipermail/dns-operations/2016-Jun...
- yrro 9y agoWhat a load of technically illiterate nonsense.
- userbinator 9y agoWow. Perhaps you should read through this and then reconsider who is "technically illiterate": https://news.ycombinator.com/item?id=14652787 https://news.ycombinator.com/item?id=14652787
- dang 9y agoThis breaks the site guidelines badly, particularly the ones about civility and avoiding shallow dismissals. We ban accounts that post like this (regardless of how wrong someone else might be), so please read https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and follow the rules from now on.
- otterley 9y agoWhat does systemd-resolved have to do with systemd's timer implementation? It's possible to agree that the resolver implementation is problematic, while other parts of the ecosystem are reasonably good.
- DC-3 9y agoTheir point is a valid one though. I don't really think the init process is the right place for timers.
- derefr 9y agoMaybe you've never tried to optimize an OS for battery life on mobile devices, then. There needs to be one place that timers happen—ideally the kernel, but a "userland kernel adjunct" like systemd is fine too—in order to be able to coalesce all the timers on the system (except for real-time ones) along some granularity scale. 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.
- theamk 9y agoIn my cronjob, I like to log the target process output, and ensure that only one timer jobs runs at a time, and apply resource limits, and have an easy way to know if the job is still running. 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.
- liveoneggs 9y agosystemd is attempting to take over unix just like gnome has always been trying to turn linux into GNOME-OS. It's all just a matter of having people with no taste given too much influence.
- qbrass 9y agoThe main code contributor to both projects is Red Hat.
- liveoneggs 9y agoexactly. Ever used jboss? :)
- deleted 9y ago[deleted]
- s17tnet 9y agoInit systems are intrinsically very complicated. Praise and thanks that someone out there do the shitty job to rewrite one that is not from the '70.
- Walkman 9y agosystemd timers are actually simpler than cron syntax!
- Sir_Cmpwn 9y agoMaybe for the person writing the timer, definitely not for the person implementing them.
- Walkman 9y agowhich is more?
- Sir_Cmpwn 9y agoMore what?
- Walkman 9y agoAre there more persons implementing the timer or more sysadmins using the timers and specifying timer syntax every day?
- Sir_Cmpwn 9y agoFor some people, myself included, on a long enough time scale you end up working on every piece of software on their system. In this case the simplicity is valued. Different tools suit different people. Cron isn't dying any time soon just because the casual Linux user is better served by systemd.
- jimktrains2 9y agoExcept that cron is simpler and more widely deployed (e.g. traditional unixes and *bad). I can't imagine cron ever going away.
- _eht 9y agoIt reminds me of ed, vi and nano. Their distributions with unix and linux can be counted on pretty safely to exist.
- qbrass 9y agoI wouldn't count on nano to be there outside of Linux distros.
- jcelerier 9y ago> Except that cron is simpler simpler to the point that you need whole libraries and helpers (such as https://www.freeformatter.com/cron-expression-generator-quartz.html https://www.freeformatter.com/cron-expression-generator-quar...) to convert from readable time to cron specifications ? Meanwhile, sd is just [Timer] OnCalendar=weekly
- Karrot_Kream 9y agoSure but there are tons of simple cron alternatives with better syntax that don't need systemd (such as fcron). In fact, Mcron from the OP can be configured using Scheme.
- jcelerier 9y ago> Sure but there are tons of simple cron alternatives with better syntax But 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.
- josteink 9y agoOn embedded you really don’t find systemd anywhere. At least not yet. Cron, busybox and friends are still good things to master.
- jcelerier 9y ago> On embedded you really don’t find systemd anywhere. don't you ? my phone from 2013 runs systemd and wayland.
- jchw 9y agoOut of curiosity, what phone/OS is that? I don't believe stock Android runs either of those, right? (iirc, they have a custom init daemon and compositor, am I wrong?)
- Mediterraneo10 9y agoThe OP is probably describing the Jolla 1 phone, released in 2013, and running Sailfish OS that was based on Systemd and Wayland from launch.
- jcelerier 9y agoIndeed
- josteink 9y agoWhile your phone may run systemd, modern phones are pretty powerful compared to platforms traditionally considered "embedded". It's also an extremely niché phone... Witch I seriously wanted to try out, but couldn't because it was actually impossible for me to buy. It's definitively not representative for phones in general, and certainly not for embedded Linux as a wider term. Edit: Things might be changing though. For instance my Netgear NAS used to run a custom Debian-derivative based on Debian 7 (which used sysvinit). But I discoverd today that after some recent updates it's now based on Debian 8 (which ships with systemd instead). Based on that, I could produce the following plot[1], on a "embedded" device. Which I now know spends a tremendous 42 seconds booting the kernel. I guess it contemplates life, the universe and everything before moving along :) [1] https://gist.github.com/josteink/3cf87479b97d8ab3eac81cba7199bbca#file-nasboot-svg https://gist.github.com/josteink/3cf87479b97d8ab3eac81cba719...
- drb91 9y agoIs there any reason to switch to systemd?
- otterley 9y agoThe fact that the Linux distributions that practically everyone uses have adopted it is pretty compelling. :) 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.
- drb91 9y agoRight, but cron works everywhere. Also, I can’t say i’ve ever had the thought “you know what cron needs? A steep learning curve and dependency management system.” That’s nuts. Cron isn’t going anywhere anytime soon.
- otterley 9y agoThat wasn't the question. The question was, "why should I use systemd?" not "why shouldn't I use cron?" 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=1h
- deleted 9y ago[deleted]
- drb91 9y agoSure. But your pitch is incredibly unrealistic for actually convincing anyone systems is obsoleting cron (except for linux distro specific packages, i’m sure).
- wbl 9y agoI once had to make something work with it. Couldn't do it, couldn't figure out what the heck was going wrong.
- Crontab 9y agoI think systemd is gross and its configuration files awful. I have often wondered why the Linux community, in general, finds it acceptable and I can only conclude that it is because they are no longer attempting to create a good Unix.
- craigsmansion 9y ago"baked" and "arbitrary": that about sums up SystemD (because software that hobbled deserves to be camel cased) development. > 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.
- Karrot_Kream 9y agoThis feels like unnecessary evangelism in a thread not about systemd.
- chriswarbo 9y agoSystemd has become quite popular among Linux distros, but it's not universal; plus Linux isn't the only Unix system around; and there's more to operating systems than just Unix. 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!)
- JdeBP 9y agoUsually "legacy" refers to something bequeathed in a will. * http://jdebp.eu./FGA/legacy-is-not-a-pejorative.html http://jdebp.eu./FGA/legacy-is-not-a-pejorative.html