• Matt
    link
    fedilink
    18 months ago

    Just write your own initialization system in bash. It is more reliable and less bloated.

  • Rose
    link
    fedilink
    228 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.)

    • Phoenixz
      link
      fedilink
      38 months ago

      I’m sorry but Cron is really easy, of all systems.

      Try using systemd with an ssh server that you want to have running on a non standard port. On non systemd it’s a 15 second ordeal while on systemd I don’t even know where to start, I pushed it out of my memories. It’s something something create files here, restart demons there, removing other files, it is WAY WAY over complicated

      • @[email protected]
        cake
        link
        fedilink
        58 months ago

        What do you mean? You literally just change the /etc/sshd config to point at a different port do you not?

        • Phoenixz
          link
          fedilink
          18 months ago

          Oh yeah, without systemd that’s all there is to it. With systemd, however, port management is taken out of the ssh config and is done how it was decades ago

            • Phoenixz
              link
              fedilink
              15 months ago

              .Aube it’s distro dependent, but Ubuntu updated ssh a while ago to be passed through systemd. Updating the port requires systemd configuration changes

      • Rose
        link
        fedilink
        28 months ago

        Well cron is “really easy” as long as your requirements are really easy too.

        Run a task at specific hour or minute or weekday or whatever? Easy peasy.

        Run a task at complex intervals? What the fuck is this syntax. How do I get it right even. Guess I’ll come back next week and see if it ran correctly.

        Actually have to look at the calendar to schedule this stuff? Oh lawd here come the hacks, they’re so wide, they’re coming

        Run a task at, say, granularity of seconds? Of course it’s not supported, who would ever need that, if you really need that just do an evil janky shellscript hack

    • @[email protected]
      link
      fedilink
      18 months ago

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

    • @[email protected]
      link
      fedilink
      English
      68 months ago

      I suppose for people in the office, it means everyone else has fucked off and the week is basically a wash.

    • @[email protected]M
      link
      fedilink
      English
      38 months ago

      Students here usually get Mondays off when the next Tuesday is a holiday. As a university sysadmin, I cherish those days because that’s when we can get actual work done without having to work around the chaotic classroom reservations or work in ten-minute bursts during breaks. It’s also when we can implement changes to the network and update the servers because the office workers don’t tend to come in.

      The last time that happened, all of us sysadmins did about three months’ worth of actual work in a few hours, then used the smaller lecture hall as a cinema for the rest of the day.

      • macniel
        link
        fedilink
        11
        edit-2
        8 months ago

        Did you know the next Friday the 13th is in December? ChatGPT didn’t know it. (I had to give it an extra date.now for it to figure it out)

  • @[email protected]
    link
    fedilink
    298 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.

    • @[email protected]
      link
      fedilink
      218 months ago

      I am typically in the group saying “systemd is overlarge with too many responsibilities” but this capability makes perfect sense for its job running services. Probably the good column.

      • @[email protected]
        link
        fedilink
        English
        58 months ago

        This kinda functionality is surprisingly apropos to a problem I have a work, I realize. And yet, I have k8s. More and more I am appreciating the niche systemd can play with pets instead of cattle and wished corps weren’t jumping to managed k8s and all of that complexity it entails immediately.

        • @[email protected]
          link
          fedilink
          18 months ago

          You can run systemd (or cron) inside a pod for scheduling and call the kubernetes API from there to run jobs and stuff. Not sure if this helps you, but it can be easy to overlook.

          • @[email protected]
            link
            fedilink
            English
            18 months ago

            haha, yeah I am well aware I could do something like that. Unfortunately, once you start working for larger companies, your options for solutions to problems typically shrink dramatically and also need to fit into neat little boxes that someone else already drew. And our environment rules are so draconian, that we cannot use k8s to its fullest anyhow. Most of the people I work with have never actually touched k8s, much less any kind of server oriented UNIX. Thanks for the advice though.

  • Arthur Besse
    link
    fedilink
    English
    14
    edit-2
    8 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
    
  • FreshLight
    link
    fedilink
    1988 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.

    • @[email protected]
      link
      fedilink
      118 months ago

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

    • @[email protected]
      link
      fedilink
      18 months 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.

    • @[email protected]
      link
      fedilink
      1098 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!”

      • @[email protected]
        link
        fedilink
        58 months ago

        I keep a persistent “sticky note” (in KDE) drop down on my top bar where I copy/paste important commands, scripts, etc.

        I actually remember to use it sometimes.

      • boredsquirrel
        link
        fedilink
        498 months ago

        I make a separate text file per command so I can search them!

        Which I dont.

        • @[email protected]
          link
          fedilink
          English
          318 months ago

          I usually print these out and put them in a safe deposit box at a bank so I never lose them

        • @[email protected]
          link
          fedilink
          128 months ago

          We can store those text files in a terminal and search for them from the command line with man command!

    • folkrav
      link
      fedilink
      58 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.

      • @[email protected]
        link
        fedilink
        28 months ago

        Fish is super useful, but I usually only start it up if I’m having trouble finding or remembering a command.

        • folkrav
          link
          fedilink
          38 months ago

          Yeah, it’s a good shell. I’ve found the lack of compatibility with some bash tools to be inconvenient enough that I just went back to zsh and found alternatives for the parts that I liked about it. Works well enough for me.

          • @[email protected]
            link
            fedilink
            18 months ago

            I’m relatively new to Linux in general (have only been on it for about a year and a half, but have taken to it like a fish to water), so forgive me if this is a dumb question, but what are some benefits to using zsh over bash? Are there any cons?

            • folkrav
              link
              fedilink
              1
              edit-2
              8 months ago

              Honestly, it’s just another shell. Both Bash and ZSH happen to be mostly POSIX compliant, so stuff that works for Bash tends to work with ZSH too. For me it’s mostly just about the stuff I can add to it - I use the antidote plugin manager to get additional autocomplete, syntax highlighting, suggestions, async prompt updates, that kind of thing.

  • peopleproblems
    link
    fedilink
    268 months 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

  • @[email protected]
    link
    fedilink
    208 months 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

    • @[email protected]
      link
      fedilink
      38 months 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.

      • @[email protected]
        link
        fedilink
        18 months 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.