QUESTION: Add a hook to check if I am running borgmatic manually in a terminal #729
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#729
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
Hi, first of all, thanks for this incredible tool.
I have been spending time over the past week configuring my backups, this is such an elegant way to make use of borg !
Thanks to the very complete and hands on documentation, I managed to do everything I needed, and even more, so I am sorry if I missed something.
I would like to use some
before
hook to check if borgmatic is being run manually in the terminal or as a 'background process' with cron or systemd. I think it is possible since borgmatic does it to write output to the stdout or syslog, but I have no idea how to go about it..My first thought was to check if we are in an interactive shell, but all my attempts failed. The best I came up with is the following:
.
The commands are executed since I get an exit code 75, but they do not work in the sense that I get that soft error code even when running
borgmatic
manually from the terminal.I also found a lead checking with
test -t 0
but had no luck there either.Any help would be greatly appreciated.
Thank you in advance.
QUESTION: Check if I am running config manuallyto QUESTION: Add a hook to check if I am running config manually in a terminalQUESTION: Add a hook to check if I am running config manually in a terminalto QUESTION: Add a hook to check if I am running borgmatic manually in a terminalInteresting use case! Have you tried looking at the value of the
$TERM
environment variable when borgmatic is run interactively vs. non-interactively? That may be one relatively easy way to differentiate within a hook.Thank you for the pointer, I did not try that approach. I am not fluent at all with bash, so I think I understood that my way of testing was wrong anyway.
I am going to try out in a different setting and post back if I was successful, or understand better why I am not. So , I will close this issue for now and reopen when I will have more time to spend on that one.
Thanks again.
Sounds good! Let me know if you end up needing more formal support from borgmatic for this.