resticprofile
resticprofile copied to clipboard
Tags on schedules
Hi
This is more a question.
I have been looking at the documentation to see if there is a way of setting the tags based on the scheduled frequency of the backup i.e hourly or weekly etc.
Is this possible?
Thanks
At the moment it not possible using a scripted or template approach since we don't have:
- Any environment variables set that would tell the profile run is scheduled (and with what settings)
- A way to dynamically set the environment from a shell hook (e.g. to set tags based on some evaluation done in the shell script)
What is possible is using inheritance (example uses version=2
to have support for __APPEND
):
version = "2"
[profiles.default]
initialize = true
repository = "{{ .Env.RESTIC_REPOSITORY }}"
[profiles.default.backup]
exclude = [ "~*", ".*" ]
tag = [ "root" ]
source = [ "/foldertobackup" ]
schedule-permission = "system"
schedule-priority = "background"
schedule-lock-wait = "10m"
schedule-log = "backup.log"
[profiles.hourly]
inherit = "default"
[profiles.hourly.backup]
tag__APPEND = ["hourly"]
schedule = "hourly"
[profiles.daily]
inherit = "default"
[profiles.daily.backup]
tag__APPEND = ["daily"]
schedule = "daily"
➜ resticprofile hourly.show
...
profile hourly:
backup:
tag: root
hourly
source: /foldertobackup
exclude: ~*
.*
schedule hourly-backup:
profiles: hourly
run: backup
schedule: hourly
permission: system
log: backup.log
priority: background
lock-wait: 10m0s
➜ resticprofile show
...
profile default:
backup:
tag: root
source: /foldertobackup
exclude: ~*
.*
Thanks for the explanation, It would be good if I could do via script hooks of even add tags automatically using version 1 script hooks.
The problem I am trying to achieve is within a web UI to automatically display what kind of scheduled backup it was.
Thanks
Hi
There is a problem with the v2 solution if I have the following schedule
[profiles.default.retention]
before-backup = false
after-backup = true
keep-hourly = 24
keep-daily = 6
keep-weekly = 4
keep-tag = [ "manual" ]
prune = false
then everything is getting tagged as root,hourly. daily is missing
Any solution for this?
Thanks
@clumbo: What we could offer is an env variable with scheduling details (comparable to the user-agent
header in HTTP protocol). That would allow to set tags using templates.
@d11ahirst: do you mean you had used the example above (with inheritance) and your daily
schedule produces snapshots without daily tag? Could you share more details on your config?
Also it could be that retention
selects all the daily
snapshots. Try adding "tag = true" to retention
. We should have different defaults here tags are not used by default when tag
is not set here.