Email or username:

Password:

Forgot your password?
rixx

Imagine wondering “When’s the next time that Christmas will be a Tuesday/Wednesday, for those sweet optimal public holidays (Jan 1st being exactly a week later)?”

Now imagine asking, idk, google or Siri or god forbid an actual calendar, instead of turning to the best tool for the job: systemd.

#systemd #linuxadmin #linux #systemd

Shell prompt reading "systemd-analyze calendar Tue *-12-25", and the answer, after some blah, saying "Next elapse: Tue 2029-12-25, From now: 5 years 1 month left"
112 comments
rixx

@dequbed Right?! It feels so wrong, and yet, systemd-timers are so *nice*. They have a status and know when they will run and when they have run, and you do need to know how to deal with calendars for this.

nadja

@rixx yeah it totally makes *sense*, but it feels wrong. I still love systemd for trying to solve the messy real world we live in, but it sure gives rise to a whole lot of unexpected features ^^

Cysio :verified_gay:​

@rixx @dequbed this is why I completely ditched cron in favor of systemd timers

rixx

“Harry, did you put the Olson database into your init system?”, Dumbledore asked calmly.

rixx

(that’s two “Dumbledore asked calmly” posts today, which led to me getting informed that the movie that gave rise to this meme came out 19 years ago, which is WRONG wrong wrong)

Dragon-sided D

@rixx I dunno... seems more like something Tom Riddle would do

don

@rixx I'm definitely feeling conflicted by this knowledge.

lambisio

@rixx Oh no, now systemd is taking over the calendar. Is there nothing sacred anymore?

rixx

@lambisio Yeah, well, I’m feeling conflicted bth. On the one hand, yes, systemd is eating everything.

On the other hand, this is for systemd-timers, and they are just so *nice*.

Florian Haas

@rixx True but the implications of setting a systemd timer for "when Christmas is on a Tuesday" are terrifying.

@lambisio

rixx

@xahteiwi @lambisio I’ll grant you this one, but, like, that’s just the consequence of being able to select *either* a date or a weekday, which isn’t too wild.

Florian Haas

@rixx Right, "do something every Friday the 13th" sounds very useful too.

@lambisio

lambisio

@xahteiwi @rixx To my recollection crontab can do that.

rixx

@lambisio @xahteiwi Not sure – I thought "* * 13 * 5" meant "both on Fridays and on the 13th of each month", and crontab.guru/#0_0_13_*_5 agrees.

In any case a huge advantage of systemd timers is your ability to query them for next / scheduled / past runs like this fwiw.

lambisio

@rixx @xahteiwi That's weird. I mean, 30 6 * * * means "at 6:30" and not "every half hour and also at 6:00". So it'd be extra weird if dow/dom were specialcased that way.

But even then, that doesn't justify "solving" the problem by subsuming it into systemd. Pretty sure there's like at leats other 200 tools to do the job.

(No, NTP is *not* one of them!)

Thomas Mayer

@lambisio @rixx
Filing a feature request to include Discordian calendar in systemd right now.

mirabilos

@rixx @amin what is wrong with the Linux world…

Christian Vogel

@rixx I’m reading your toot while sitting in the aptly named lounge in the hotel I’m staying tonight…

A sign on a wall reading “Lennarts Rooftop Lounge”, and has an arrow pointing to the right…
Fritz Adalis

@rixx @kevin
What font is this? It looks unnaturally clear.

scy

@rixx I love it.

But it's not feature complete until it supports all of remind(1) script.

cerement

@rixx

or convince everyone to switch to a 13-month perennial calendar where 25 Dec is always Thursday AND 01 Jan is always Monday

Daniel Ligon

@cerement @rixx

13 months of 28 days is 364 days

The extra day is a Holiday and is not a day of the week?

Call it Earth Orbit Day, or something.

MegatronicThronBanks

@rixx Wow that's the first useful thing I've ever seen it do!

rixx

@megatronicthronbanks gotta try harder with the trolling, among init system wars, this doesn't even register

CatSalad🐈🥗 (D.Burch) :blobcatrainbow:

@rixx This is systemd propaganda! /jk

This feel so wrong, like emojis source code (I love it!)

rixx

@catsalad I feel you *so* much, I’ simultaneously shuddering and delighted at the consequences. Cuz, like, timers are obviously better than cronjobs in many-if-not-most cases, and timers need calendars, and … here we are.

Joviko Wi

@rixx @catsalad

🤯

From the very detailed man page:

Example 14. Show parsing of timespans

$ systemd-analyze timespan 1s 300s '1year 0.000001s'
Original: 1s
μs: 1000000
Human: 1s

Original: 300s
μs: 300000000
Human: 5min

Original: 1year 0.000001s
μs: 31557600000001
Human: 1y 1us

rixx

@metaphil systemd-because-timers-and-scheduling-require-calendars klang nicht so gut?

schrotthaufen

@rixx @catsalad In the name of all that is sacred, why is that real?!?

rixx

@schrotthaufen @catsalad Because systemd-timers are an actually really cool thing, but if you implement a scheduling system, you need to understand calendars, to allow people to say "do this every Monday".

(sorry, this is assuming you wanted an answer)

Jann Horn

@rixx this doesn't work properly though:

jann@tigerlap:~/linux$ systemd-analyze calendar --base-time='2010-01-01' "*-*-* 23:59:60"
Failed to parse calendar specification '*-*-* 23:59:60': Invalid argument
Daniel

@rixx
People with strong opinions about systemd right now:

Gilgwath

@rixx At least it will get you the correct answer. Try asking chatGPT stuff like that 😂🫣

Patrick Morris Miller

@rixx Want to know why only Apple products are allowed in my house? This. This is why.

(Dear penguinheads, my killfile thirsts for your souls. If you reply I shall feed you to it.)

rixx

@kentenmakto I feel you deeply, my troll soul wanted to start the post with "can your initd do THIS"

ordinary space cat

@rixx systemd-analyze calendar is such a great tool :blobcatsurprised:

ttamttam

@rixx it is funny. But honestly I'm not even conflicted about this. If you want to run timers, which is very reasonable for an init system; you need to handle real, human, times and all their messiness. Say you want to automate a holiday email, or manage processing of documents at certain business defined times.

wink

@ttamttam I love your optimism if you actually trust a random linux box (with systemd or without) to run this timer in 5 years, through (supposedly) 1-2 OS upgrades. @rixx

ttamttam

@wink @rixx
Honestly since I switched to NixOS (btw)... Yeah.
But same could be said for Ansible or Chef or any kind of declarative infrastructure as code setup. Systemd timers have been rock solid for me. So, like you implied, the issue is not the timer but making sure the config survives. Good configuration hygiene goes a long way in mitigating this.

rixx

@ttamttam @wink likewise, most of my servers have been around for easily five years or more, and while I am far from a professional sysadmin, and I have broken many things, misplacing my systemd files has never been one of them.

sabik

@wink @ttamttam @rixx
Realistically, you'd be scheduling things like "1st and 15th of each month" or "first Saturday of each month", maybe annually at most; it just winds up that by the time you implement the useful patterns, you also get impractical ones, like "each time Christmas falls on Tuesday"

rixx

@ttamttam I did say that in my other replies! I was just going for funny - but then, I am German, so I probably should just... Not do that

loop0

@rixx soon we are going to be naming SystemD/Linux instead of GNU/Linux

John Timaeus

@rixx

I actually demonstrated this a few classes ago. As a way to figure out the furthest out you can set a cron job. I think it was on a Wed 29 Feb.

All the LLMs gave a wrong answer.

zetaReserve

@rixx the real question for me is ... how are you able to post this information almost one month in advance?

rixx

@zetareserve yeah, the rounding is a bit wild there

Cy
W-why would systemd even have that
Anatol

@rixx delightfully cursed (but yeah, it does make a lot of sense!)

Now - can it do Easter?

Taneb
@dngrs @rixx I think you'll have to wait a very long time before you find a year when Easter falls on a Tuesday....

Serious answer: I don't think so
UpLateGeek

@rixx perfect, don’t forget to let John Connor know so he can take a well-deserved break. After all, that’s the same year he sent Kyle Reese back to 1984, on a mission to save Sarah Connor’s life (and, indeed, impregnate her to create John Connor in the first place).

Cryptomon

@rixx meine Tochter fragt ständig, wann ihr nächster Geburtstag am Geburtsgeburtstagtag (Neologismus von ihr) sein wird und ich rechne jedesmal rum. Danke!
(Sie ist am Sonntag den 19.10.2014 geboren, dieses Jahr war es ein Samstag, da nächstes Jahr kein Schaltjahr ist, wird es nächstes Jahr so weit sein. Prüf ich gleich am Rechner 🤪)

proedie

@rixx Yeah, but does it do moon phases?

Bruce Heerssen

@rixx
Oh, this is brilliant. I will never need this, but it's absolutely brilliant. Thanks.

Em :anarchistflagblack:

@rixx and then imagine for most of the world christmas applies too, the main holiday is on the 24th 😎

rixx

@Em is it really? The countries I have lived in are evenly split on the issue, and eg here in Germany, the 24th isn't even a full public holiday, because it is, after all, only Christmas Eve.

Em :anarchistflagblack:

@rixx traditionally, Christmas Eve is the main holiday (where presents are given and the churches are visited) and afaik in Germany, 24th is a full holiday but that might have changed in the last years tbh since I burned out and left the world of labor lol.

rixx

@Em The 24th has ~never been a full holiday. The 25th and 26th are full holidays, the 24th and 31st are half holidays.

It’s true that the gift-giving in Germany is traditionally on the 24th, though the church visits are ~late at night or on the 25th in the morning for those who can’t do late nights.

Idk how you’re counting “most of the world” part, even ignoring countries that celebrate January 6th – I know several countries where the 25th is proper Christmas, and 24th "just" the eve.

Em :anarchistflagblack:

@rixx a fair objection and I think I might have been a bit biased here😞

David JONES

@rixx I wonder if Python packaging can do this too...

Zach (Ela) - TechnicalOtter

@rixx every time I learn about something new systemd can do, the more I wonder "is systemd an operating system of it's own?"

dram🎀

@rixx ooh i like doing this party trick with friday the 13th dates. far more useful (?)

Terminal screenshot showing the command: TZ=UTC systemd-analyze calendar --iterations 5 'fri *-*-13'

Output: with some fluff, but the answer is: 2024-12-13, 2025-06-13, 2026-02-13, 2026-03-13, 2026-11-13

Full text:

[dram@sakuya ~]% TZ=UTC systemd-analyze calendar --iterations 5 'fri *-*-13'
  Original form: fri *-*-13
Normalized form: Fri *-*-13 00:00:00
    Next elapse: Fri 2024-12-13 00:00:00 UTC
       From now: 1 month 15 days left
   Iteration #2: Fri 2025-06-13 00:00:00 UTC
       From now: 7 months 14 days left
   Iteration #3: Fri 2026-02-13 00:00:00 UTC
       From now: 1 year 3 months left
   Iteration #4: Fri 2026-03-13 00:00:00 UTC
       From now: 1 year 4 months left
   Iteration #5: Fri 2026-11-13 00:00:00 UTC
       From now: 2 years 0 months left
MarjorieR

@rixx total overkill for something you can bracket in you head (7 years - 1 or 2 for leap years) and then just look it up in your evolution calendar.
(Don't have the systemd cancer anyway).

rixx

@marjolica aww, I knew it would bring out the trolls eventually! It’s so heart-warming to see the old Linux traditions alive and well.

MarjorieR

@rixx strikes me that you're the one trolling.
No doubt I wont be around to react when you get to enjoy your next but one public holiday.

rixx

@marjolica hmmmmm yes, I’m sure “systemd cancer” was not trolling at all, just a calm reasoned response. byeee 😘

MarjorieR

@rixx "Cancer is a group of diseases involving abnormal cell growth with the potential to invade or spread to other parts of the body."
Systemd is a cancer on the body of Gnu/Linux. As originally sold, as a simple init system, it would have been fine. That there's a systemd.calendar is simply evidence of the spread.

thbe

@marjolica @rixx Good thing is that you can freely pick the Init system of your choice and do not need to resort to poor comparisons and insensitive language out of nowhere. Oh wait...

Mindiell

@rixx shouldn't next elapse be in one month ?

rixx

@Mindiell rounding is hard, let’s go shopping

climbertobby

@rixx can SysV-init do that? No? thought so!

🤣

rixx

@climbertobby You would not believe how tempted I was to end my post like that – took all my willpower to walk past …

Ludovic Poujol

@rixx

Oh nice!
I guess you can even use it to know when would be the next "Firday 13th" :D

Using the command systemd-analyse to know when would be the next Friday 13th.
Output returns that it will be on Fri 2024-12-13 00:00:00 CET
And that's in  1 month and 14 days
Ben Hearsum

@rixx thanks i hate it. but i also applaud you

saiarcot895

@rixx this probably uses fewer resources (taking everything into account) than any of the other approaches you mentioned.

Jakub Klawiter :mastodon:

@rixx
i can imagine i like to know that but… never did, if so…

$ for n in $(seq 24 34); do date --date="20${n}1225" | grep Tue ; done;
Tue Dec 25 00:00:00 CET 2029
Eepy Woem

@rixx systemd as a tasker app :neocat_woozy:

HAMMER SMASHED SIR 🇺🇦

@rixx cc @q66 look there's this but also systemd-analyze timestamp to grok those gnu date-ish expresions (i had no idea)

Go Up