scheduling brainstorm/feature-request: battery-level condition (rather than ac-power condition) #419
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#419
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
As you can see step
ii
is the only chance for backups to occur automatically, butExpected behavior: docs feature request
I realize this isn't a bug/feature-request for borgmatic - it's more a feature request for the docs - specifically these wonderful sample files.
Other notes / implementation ideas
I'm guessing I'm not the only one who has similar usage patterns and found borgmatic excellent to get started with. So I'm hoping this can be a bug to keep track of ideas untli something solid comes along.
If I'm understanding the systemd docs right, there's really nothing more granular than
ConditionACPower=true
(ie: there's noConditionPowerReserve=0.6
or anything). So I think this might become slightly more complicated as it'd have to be logic in borgmatic (or a script) rather than systemd files.Environment
borgmatic version:
1.5.13
Fwiw, I'm not running as root - I've tweaked the systemd samples a bit because I'm only backing up my user files. Here's what I have in case it's useful to anyone (that took a bit of figuring out - so I'm happy to add a "user" sample to the repo if anyone wants that).
borgmatic installation method: pip3
Borg version: 1.1.9
operating system and version: debian buster 10.9
Hi @jzacsh ,
you can use a command line tool which provides you the battery status and use it in a script and as pre-backup hook. The script would exit with code 75 if the battery level is too low so that borgmatic silently skips the backup.
You can find some options for checking the battery here https://www.cyberciti.biz/faq/linux-laptop-battery-status-temperature/
ah, indeed that works prefectly, thanks!
for anyone else looking for a quick answer, here's exactly what i did that works well:
c758a802fb
d6733bcbac
and here's some sample output of what it looks like with systemd
EDIT 2.5 years later: if anyone finds the scripts mentioned useful, beware that its reliance on
upower
has caused me trouble sometimes, so I've started to optionally switch the logic to use/sys/class/
files instead; see the latest home of the script here (stable link here) (set the_experiment_use_kernel_sysdir
variable accordingly).Awesome.. creative solution! I've taken a stab at documenting (or at least mentioning) the use case here: https://torsion.org/borgmatic/docs/how-to/backup-to-a-removable-drive-or-an-intermittent-server/
I've also added a comment to the systemd service file about
ConditionACPower=true
.Thanks for bringing this up!