feat(stdlib): added a basic borg client custom promise
This commit is contained in:
parent
518cbed944
commit
48f2e9a2cb
5 changed files with 174 additions and 1 deletions
27
stdlib/backups/borg/borg-script-template
Normal file
27
stdlib/backups/borg/borg-script-template
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
on_exit() {
|
||||
exit $?
|
||||
}
|
||||
trap on_exit EXIT
|
||||
|
||||
archiveName="%s-%s-$(date +%%Y-%%m-%%dT%%H:%%M:%%S)"
|
||||
archiveSuffix=".failed"
|
||||
|
||||
# Run borg init if the repo doesn't exist yet
|
||||
if ! borg list > /dev/null; then
|
||||
borg init --encryption none
|
||||
fi
|
||||
(
|
||||
borg create \
|
||||
--compression auto,zstd \
|
||||
"::${archiveName}${archiveSuffix}" \
|
||||
'%s'
|
||||
)
|
||||
borg rename "::${archiveName}${archiveSuffix}" "${archiveName}"
|
||||
|
||||
borg prune \
|
||||
--keep-daily=14 --keep-monthly=3 --keep-weekly=4 \
|
||||
--glob-archives '%s-%s*'
|
||||
borg compact
|
Loading…
Add table
Add a link
Reference in a new issue