A cranky biologist who means well. My hobbies include long walks off short piers and anything science related.

  • 0 Posts
  • 6 Comments
Joined 1 year ago
cake
Cake day: June 25th, 2023

help-circle



  • meyotch@slrpnk.nettoLinux@lemmy.mlSystemd timer unit
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 months ago

    Your systemd file looks ok, but I think it’s doing exactly what you are telling it.

    The solution may lie in the backup.service. Is that code you can modify? The OnCalendar=weekly doesn’t specify when in the week the service should run so that config may be vague.

    If I understand the desired function here, you will need the service up all the time. It will just wait politely and occasionally run the specific backup script. It’s up to the backup script to determine when the last backup was made and either exit early because it hasn’t been a week or run the backup and reset a flag file.

    At least that’s the approach I would take. Systemd is a very vigilant, but very stupid, service manager. It just watches and triggers services based on just a few criteria. Any logic more complex needs to go in the service itself.