How to skip pruning when running from systemd timer #775

Closed
opened 2023-10-24 11:14:52 +00:00 by kalsan · 3 comments

Hi!

The systemd service borgmatic.timer which executes borgmatic.service is a great way to automate backups in the background. The way I understand it, the timer calls the service, which runs borgmatic without any action which defaults to prune, create, check. However, in my scenario I want to prevent clients to prune backups (I'm using append-only and I want to prune on the backup server only).

The man page states:

# At least one of the "keep" options is required for pruning to work. See
# https://torsion.org/borgmatic/docs/how-to/deal-with-very-large-backups/
# if you'd like to skip pruning entirely.

But this does not apply for the default systemd service.

I see the following possibilities to achieve this:

  • Edit the service and change the command for ExecStart and ExecStartEx from /usr/bin/borgmatic to /usr/bin/borgmatic create check
  • Change the config file and set keep values to ridiculously large numbers (but I don't see a way to completely disable pruning, as removing retention options causes an error)
  • Run borgmatic cutom via cronjob

Is there a smarter way to achieve this?

This is Debian 12, borgmatic 1.7.7

Best,
Kalsan

Hi! The systemd service `borgmatic.timer` which executes `borgmatic.service` is a great way to automate backups in the background. The way I understand it, the timer calls the service, which runs `borgmatic` without any action which defaults to prune, create, check. However, in my scenario I want to prevent clients to prune backups (I'm using append-only and I want to prune on the backup server only). The man page states: ``` # At least one of the "keep" options is required for pruning to work. See # https://torsion.org/borgmatic/docs/how-to/deal-with-very-large-backups/ # if you'd like to skip pruning entirely. ``` But this does not apply for the default systemd service. I see the following possibilities to achieve this: - Edit the service and change the command for `ExecStart` and `ExecStartEx` from `/usr/bin/borgmatic` to `/usr/bin/borgmatic create check` - Change the config file and set keep values to ridiculously large numbers (but I don't see a way to completely disable pruning, as removing retention options causes an error) - Run borgmatic cutom via cronjob Is there a smarter way to achieve this? This is Debian 12, borgmatic 1.7.7 Best, Kalsan
Owner

The options you've outlined are really pretty much it at this point. However here's a not-yet-implemented ticket that I think you'll be interested in: #701. That's probably the "smarter" way to achieve this.

The options you've outlined are really pretty much it at this point. However here's a not-yet-implemented ticket that I think you'll be interested in: #701. That's probably the "smarter" way to achieve this.
witten added the
question / support
label 2023-10-24 16:07:53 +00:00
Author

@witten Thank you very much for your blazingly fast answer! Indeed that would be a good solution. Closing in favor of #701

@witten Thank you very much for your blazingly fast answer! Indeed that would be a good solution. Closing in favor of #701
Author

Conclusion: As editing the systemd service appeared to have no effect (likely my fault), the solution I chose and that is working well is:

# /etc/borgmatic/config.yaml

#...
retention: # this is for an older version, newer version will not have this nesting, see docs
    keep_within: 10y

Hope this helps anyone coming across this.

Conclusion: As editing the systemd service appeared to have no effect (likely my fault), the solution I chose and that is working well is: ```yaml # /etc/borgmatic/config.yaml #... retention: # this is for an older version, newer version will not have this nesting, see docs keep_within: 10y ``` Hope this helps anyone coming across this.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#775
No description provided.