• Arthur Besse@lemmy.ml
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    2 hours ago
    $ systemd-analyze calendar tomorrow
    Failed to parse calendar specification 'tomorrow': Invalid argument
    Hint: this expression is a valid timestamp. Use 'systemd-analyze timestamp "tomorrow"' instead?
    $ systemd-analyze timestamp tuesday
    Failed to parse "tuesday": Invalid argument
    Hint: this expression is a valid calendar specification. Use 'systemd-analyze calendar "tuesday"' instead?
    

    ಠ_ಠ

    $ for day in Mon Tue Wed Thu Fri Sat Sun; do TZ=UTC systemd-analyze calendar "$day 02-29"|tail -2; done
        Next elapse: Mon 2044-02-29 00:00:00 UTC
           From now: 19 years 4 months left
        Next elapse: Tue 2028-02-29 00:00:00 UTC
           From now: 3 years 4 months left
        Next elapse: Wed 2040-02-29 00:00:00 UTC
           From now: 15 years 4 months left
        Next elapse: Thu 2052-02-29 00:00:00 UTC
           From now: 27 years 4 months left
        Next elapse: Fri 2036-02-29 00:00:00 UTC
           From now: 11 years 4 months left
        Next elapse: Sat 2048-02-29 00:00:00 UTC
           From now: 23 years 4 months left
        Next elapse: Sun 2032-02-29 00:00:00 UTC
           From now: 7 years 4 months left
    

    still image from "Zach Galifianakis Math" gif, with Zach looking contemplative with math notation floating in front of his face

    (It checks out.)

    Surprisingly its calendar specification parser actually allows for 31 days in every month:

    $ TZ=UTC systemd-analyze calendar '02-29' && echo OK || echo not OK
      Original form: 02-29
    Normalized form: *-02-29 00:00:00
        Next elapse: Tue 2028-02-29 00:00:00 UTC
           From now: 3 years 4 months left
    OK
    $ TZ=UTC systemd-analyze calendar '02-30' && echo OK || echo not OK
      Original form: 02-30
    Normalized form: *-02-30 00:00:00
        Next elapse: never           
    OK
    $ TZ=UTC systemd-analyze calendar '02-31' && echo OK || echo not OK
      Original form: 02-31
    Normalized form: *-02-31 00:00:00
        Next elapse: never           
    OK
    $ TZ=UTC systemd-analyze calendar '02-32' && echo OK || echo not OK
    Failed to parse calendar specification '02-32': Invalid argument
    not OK
    
  • مهما طال الليل@lemm.ee
    link
    fedilink
    arrow-up
    48
    arrow-down
    12
    ·
    edit-2
    14 hours ago

    systemd is the future, and the future has been here for over a decade and yet old Unix and BSD purists still cry about it

    I have one simple thing to say to the downvoters: I am not using a minicomputer from 1970, why should I be bound by the limits set then?

      • Kusimulkku@lemm.ee
        link
        fedilink
        arrow-up
        21
        arrow-down
        1
        ·
        10 hours ago

        I’ve felt like systemd has been a breeze compared to the hodgepodge of different stuff that preceded it. Now most distros have it mostly the same way, tools are well documented, things works together. It wasn’t always like that from what I remember

  • kameecoding@lemmy.world
    link
    fedilink
    arrow-up
    15
    ·
    13 hours ago

    It is literally happening this year.

    24th is Tuesday. 1st of January is Wednesday and as a bonus Jan 6 is also a holiday in my country and that’s Monday.

    So from dec 22 to jan 6 i can be home by using just 6 days off

    • UllallullooA
      link
      fedilink
      arrow-up
      2
      ·
      4 hours ago

      The 25th is a Wednesday, not a Tuesday like he was wanting. Tuesday is nice because you get a four-day weekend without using any days off. (Though, usually you’d get the next off if it was a Monday or Sunday or whatever.) I think the best is Friday or Monday because then New Year’s gives you a three-day weekend too.

      • kameecoding@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        3 hours ago

        to me it doesn’t matter tbh, as long as the 24th is somewhere monday-wednesday, that means days off that week, we get 24,25,26 off.

  • FreshLight@sh.itjust.works
    link
    fedilink
    arrow-up
    180
    arrow-down
    1
    ·
    20 hours ago

    Oh fuck. I’ll use this from now on. Except for if I won’t use it next week. Then I’ll forget about it because my memory is a damn sieve.

    • meiti@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      5 hours ago

      Using a large shell history (currently at 57283 entries) along with readline (and sometimes fzf) has served me well over the past few yeas when trying to remember past commands.

    • Technofrood@feddit.uk
      link
      fedilink
      arrow-up
      7
      ·
      9 hours ago

      Use a systemd timer to send yourself a reminder. Discoverd them recently myself and honestly liking them more than cron.

    • folkrav@lemmy.ca
      link
      fedilink
      arrow-up
      3
      ·
      17 hours ago

      I feel you. It’s however gotten a lot better since I turned some of these commands into abbreviations. They’re aliases that expands in place, more or less. Fish has them natively, I personally use zsh-abbr.

  • mogoh@lemmy.ml
    link
    fedilink
    arrow-up
    73
    ·
    18 hours ago

    Usually such things have a simple explanation. systemd does a lot with time and date, for example scheduling tasks. It’s quite obvious that it has this capabilities, when you think about it.

    • m4m4m4m4@lemmy.world
      link
      fedilink
      arrow-up
      38
      arrow-down
      6
      ·
      18 hours ago

      Usually such things have a simple explanation. systemd does a lot with time and date, for example scheduling tasks. It’s quite obvious that it has this capabilities, when you think about it.

      FTFY

      • Phoenixz@lemmy.ca
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        5 hours ago

        Too much

        But that has been a complaint for 10 years and it’s only gotten worse

        I wouldn’t mind systemd if it weren’t for the fact that it was to be a startup system that promised to make everything easier and faster to startup yet managing systemd is a drag at best, and of it did one thing it’s making my systems boot up like mud

        • Kusimulkku@lemm.ee
          link
          fedilink
          arrow-up
          3
          ·
          4 hours ago

          I feel like the glued together collection of scripts was way worse to manage than systemd.

    • bricked@feddit.org
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      4
      ·
      11 hours ago

      I thought the same, but didn’t we already have things like chron syntax for this? Systemd didn’t have to build its own library.

        • bricked@feddit.org
          link
          fedilink
          English
          arrow-up
          4
          arrow-down
          1
          ·
          7 hours ago

          Aight, didn’t know that. I cannot yet imagine any scheduled task that would require anything more advanced than cron (or a similar standalone syntax), but I’ll just trust you with that one.

  • peopleproblems@lemmy.world
    link
    fedilink
    arrow-up
    25
    ·
    19 hours ago

    Well. I mean, that’s pretty cool. I don’t think I would have ever guess that was an actual function from systemd but here we are