aboutsummaryrefslogtreecommitdiff
path: root/backends/borg.sh
diff options
context:
space:
mode:
authorGravatar TheMightyV <themightyv@protonmail.com> 2022-01-02 20:12:27 +0100
committerGravatar TheMightyV <themightyv@protonmail.com> 2022-01-02 20:12:27 +0100
commitde4fc74d50d536f524aa4c65e270123bfe8ef893 (patch)
tree977cda9219a434d5d4f8618fc7accde7cb7ef7d3 /backends/borg.sh
parent4baf9150016177582dd56a1bf3c09a3cad5aa050 (diff)
downloadminecraft-server-tools-de4fc74d50d536f524aa4c65e270123bfe8ef893.tar.gz
added backup restoration
Diffstat (limited to 'backends/borg.sh')
-rw-r--r--backends/borg.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/backends/borg.sh b/backends/borg.sh
index d3d9c63..999067f 100644
--- a/backends/borg.sh
+++ b/backends/borg.sh
@@ -19,7 +19,7 @@ function borg_create_backup() {
echo "borg: starting backup to \"$BACKUP_DIR\""
borg create \
- "${BACKUP_DIR}::${BACKUP_NAME}_{hostname}_{now}" \
+ "${BACKUP_DIR}::${BACKUP_NAME}_$(date +'%F_%H-%M-%S')" \
"$WORLD_NAME" \
--filter AME \
--compression lz4 \
@@ -56,6 +56,11 @@ function borg_create_backup() {
return $RETCODE
}
+function borg_ls_remote() {
+ export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND"
+ borg list "$1" | cut -d' ' -f1
+}
+
function borg_ls() {
export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND"
for BACKUP_DIR in ${BACKUP_DIRS[*]}
@@ -64,3 +69,12 @@ function borg_ls() {
borg list "$BACKUP_DIR"
done
}
+
+function borg_restore() {
+ export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND"
+ REMOTE="$1"
+ SNAPSHOT="$2"
+
+ export BORG_REPO="$REMOTE"
+ borg extract "${REMOTE}::${SNAPSHOT}"
+}