• FreshLight@sh.itjust.works
    link
    fedilink
    arrow-up
    168
    arrow-down
    1
    ·
    2 months 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.

    • Catoblepas@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      87
      arrow-down
      1
      ·
      2 months ago

      Just take the next step and make a text file you dump all these commands into and then forget about in a week. When you randomly stumble across it years from now you’ll be able to say “wow, I could have used this 10 months ago if I remembered it existed!”

    • Technofrood@feddit.uk
      link
      fedilink
      arrow-up
      8
      ·
      2 months 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
      5
      ·
      2 months 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.

    • exu@feditown.com
      link
      fedilink
      English
      arrow-up
      42
      ·
      2 months ago

      You need a calendar and time handling anyways for logging purposes and to set timers correctly. It’s likely not that much extra work exposing that functionality.

      • Kusimulkku@lemm.ee
        link
        fedilink
        arrow-up
        17
        arrow-down
        1
        ·
        2 months ago

        No, UNIX philosophy demands that every single one of those things is one or more separate things and that half of them are poorly or not at all maintained. Just like God intended.

        • DrDystopia@lemy.lol
          link
          fedilink
          arrow-up
          4
          arrow-down
          5
          ·
          2 months ago

          Finding the next super holiday is a core system feature I could survive without. 🎉

          • Kusimulkku@lemm.ee
            link
            fedilink
            arrow-up
            6
            arrow-down
            1
            ·
            edit-2
            2 months ago

            Well, date time stuff for a system working with timers and scheduling actions might be pretty useful…

  • mogoh@lemmy.ml
    link
    fedilink
    arrow-up
    75
    ·
    2 months 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.

    • bricked@feddit.org
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      4
      ·
      2 months 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
          6
          arrow-down
          1
          ·
          2 months 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.

    • ziggurat@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      Have you tried emacs with evil mode? It’s a bit slow, not as slow as VS code or anything, but not really fast. But it’s basically neovim but you get to use lisp to configure it instead of lua

  • مهما طال الليل@lemm.ee
    link
    fedilink
    arrow-up
    50
    arrow-down
    14
    ·
    edit-2
    2 months 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?

    • pimeys@lemmy.nauk.io
      link
      fedilink
      arrow-up
      33
      ·
      2 months ago

      Yeah, I’m also one of these people silently enjoying systemd and wayland. Every now and then there’s fuzz on one of these. I shrug, and move on still enjoying both of them.

    • Something Burger 🍔@jlai.lu
      link
      fedilink
      arrow-up
      5
      ·
      2 months ago

      They are also still complaining about PulseAudio, despite Pipewire having mostly replaced it, while spending hours fiddling with ALSA to use their headphones.

  • lazynooblet@lazysoci.al
    link
    fedilink
    English
    arrow-up
    31
    ·
    2 months ago

    In the UK, if Christmas or New Year falls on a weekend, a seperate equivalent holiday is made during the week to compensate.

    • blackn1ght@feddit.uk
      link
      fedilink
      arrow-up
      11
      ·
      2 months ago

      Wait, do other countries not do this? So if a public holiday falls on a Saturday it doesn’t get pushed to Monday?

    • my_hat_stinks@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      This is true for all public holidays in the UK, there’s a (usually) fixed number of public holidays but the dates are flexible.

      They’re also included in the minimum 28 days paid time off too, meaning if you’re a full time worker and have to work on a bank holiday your employer is legally required to offer an extra day off somewhere else instead, either a fixed date or added to your holiday allowance. Conversely, the “extra” day off you get when a monarch keels over may be subtracted from your holiday allowance for the year. This is also why my employer is allowed to follow English bank holidays despite having next to no presence in England; the number is fixed but the dates are not.

  • umbraroze@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    2 months ago

    Well, systemd developers made one of the classic blunders a software developer can do: make a program that has to deal with time and dates. Every time I have to deal with timestamps I’m like “oh shit, here we go again”.

    Anyway, as I understood it the reason this is in systemd is because they wanted to replace cron, and it’s fine by me because cron has it’s own brain-hurt. (The cron syntax is something that always makes me squint real hard for a while.)

    • flying_sheep@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      Yeah and they actually added some usability in the form of that utility helping you debug what you’re doing. Pretty nice!

  • frezik@midwest.social
    link
    fedilink
    arrow-up
    18
    ·
    2 months ago

    This plays some kind of role in the debate of systemd being good or not. I’m not sure if goes in the good column or the bad column, but I know it goes into a column.

  • ScreaminOctopus@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    16
    arrow-down
    1
    ·
    2 months ago

    This is basically just a way nicer, more flexible cron syntax being dressed up as something ridiculous. There are legitimate reasons for wanting something like this, like running some sort of resource heavy disk optimization the first Friday evening of every month or something.

  • Arthur Besse@lemmy.ml
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    2 months 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