this post was submitted on 27 Oct 2024
1260 points (99.5% liked)

linuxmemes

21114 readers
1215 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.

  • Please report posts and comments that break these rules!

    founded 1 year ago
    MODERATORS
    top 50 comments
    sorted by: hot top controversial new old
    [–] [email protected] 16 points 15 hours ago (2 children)

    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.)

    [–] [email protected] 1 points 13 hours ago (2 children)

    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] 3 points 8 hours ago

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

    [–] [email protected] 2 points 9 hours 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] 1 points 13 hours 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] 1 points 17 hours ago

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

    [–] [email protected] 22 points 1 day 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.

    [–] [email protected] 9 points 1 day ago (1 children)

    Systemd ignored my calendar override for the builtin raid scanner, so every week my server would chug to a halt to scan the entire array.

    In true systemd fashion, the documentation could not explain this behavior, so I had to make a full copy override instead of a merge override because reasons.

    [–] [email protected] 4 points 1 day ago

    Did setting OnCalendar to the empty string not work? https://unix.stackexchange.com/a/479745

    [–] [email protected] 5 points 1 day ago

    Ahh, you made my day!

    [–] [email protected] -1 points 1 day ago (1 children)

    Systemd. A tool created in search of problem.

    [–] [email protected] 10 points 1 day ago (1 children)

    The problem: incomprehensible init scripts

    [–] [email protected] 14 points 1 day ago* (last edited 1 day 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
    
    [–] [email protected] 29 points 1 day ago (2 children)

    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] 21 points 1 day ago (1 children)

    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] 5 points 1 day ago (1 children)

    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] 1 points 8 hours 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] 3 points 1 day ago

    I think it depends which side of the debate one is on?

    load more comments
    view more: next ›