Auto-generate systemd timer / launchd agent & Windows Task Scheduler

Today I’ve released a big update on resticprofile, which can now schedule your backup profiles automatically. It works for systemd, launchd on macOS and Windows Task Scheduler.

Here’s a configuration example (in YAML, but you can also use TOML, JSON or HCL):


    password-file: azure-key
    repository: "azure:restic:/"

        AZURE_ACCOUNT_NAME: "my_storage_account"
        AZURE_ACCOUNT_KEY: "my_super_secret_key"

        source: "~/Documents"
        - "Mon..Fri *:00,15,30,45" # every 15 minutes on weekdays
        - "Sat,Sun 0,12:00"        # twice a day on week-ends
        schedule-permission: user

        schedule: "Sat 1:00"
        schedule-permission: user

        keep-within = "30d"
        schedule: "Sun 3:30"
        schedule-permission: user

    password-file: etc-key
    repository: "local:/mnt/external/backup"
    run-before = "mount /mnt/external"
    run-after = "umount /mnt/external"
    run-after-fail = "umount /mnt/external"

        source: /etc
        check-after: true
        schedule: "04:00"
        schedule-permission: system

        after-backup: true
        keep-last: 90

In this configuration, you have two profiles documents-to-azure and config-to-usb.

You have 3 schedules on the first profile: backup, check and retention (it’s running the forget command), and 1 schedule on the second profile.

To schedule these profiles to run automatically you just need to run these two commands and you’re good to go!

The first profile runs under your user privileges:

$ resticprofile -n documents-to-azure schedule

The second needs sudo (on unixes) or Administrator privileges on Windows (resticprofile will ask you to restart as Administrator automatically)

$ sudo resticprofile -n config-to-usb schedule

It’s very straightforward with systemd and Windows Task Scheduler :slightly_smiling_face:
I’m compiling a HOW-TO guide for macOS because it’s a little but more involved than that :slightly_frowning_face:

1 Like

I just found this project on GitHub, looks cool!