[question] Is it possible to run before_backup hook not only once, but everytime a repo starts #320
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#320
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Im backuping up an VPS into a mini pc in my home, but I use port knocking to access the mini pc, so I put the port knocking script into before_backup hook, but I have 2 repos (1 to backup into the internal hdd and another in the external hdd), so when the 2th repo backup starts it fails (bacause the port is now closed).
Can I instruct before_backup to run everytime before starting a repo backup? Or maybe create a new hook called before_repo_backup , not sure.
Thanks very much! I been using borgmatic and it's awesome. Keep up the awesome work.
[question] Is it possible to run before_backup hook not only once, but everytime starts every repo.to [question] Is it possible to run before_backup hook not only once, but everytime a repo startsThank you for filing this ticket, and for the kind words!
I could see adding a hook called
before_repo
orbefore_repository
. Question though: Would it make sense to run regardless of actions specified (create
,prune
,check
, etc.)? I imagine that for any action that needs to interact with the remote repository, you'd need the port knocking script to run first...?Yes, it would be needed to run for any action.
Okay, thanks!
ah another cool thing for this feature, is the possibility to pass the repo hostname to the script, to make it more generic, so the repos are in diffrent hosts, something like this:
before_repo: port_knocking_script.sh %h
That's a great idea.. I've thought of something similiar with some of the existing hooks. For simplicity's sake, I could see just unconditionally passing in the repository path as the first parameter to the script (no
%h
needed). And then it's up to the script to do whatever it wants with that.networkjanitor referenced this issue2020-08-04 19:48:53 +00:00
Part of this will be implemented once #473 is released. Specifically, all the
before_backup
,after_backup
hooks will run on a per-repository basis, and the full repository path (including hostname) will be able for interpolation as therepository
variable.The one part of this ticket that isn't yet implemented is a general per-repository hook that gets run for all actions (
create
,prune
, etc.).This was implemented a while ago! (It's in borgmatic 1.7.0+.)
before_actions
/after_actions
are the new hooks for this and they run once per configured repository.