aboutsummaryrefslogtreecommitdiff
path: root/backends/bup.sh
diff options
context:
space:
mode:
authorGravatar TheMightyV <themightyv@protonmail.com> 2022-01-04 22:17:50 +0100
committerGravatar TheMightyV <themightyv@protonmail.com> 2022-01-04 22:17:50 +0100
commitc94132808d2a3499f19f86424bfdedf9e0c39312 (patch)
treeed77cd2eb5b3f73e10a081918be3ee8e12b53d84 /backends/bup.sh
parentfc9f81108360e528f8adfccf8051c79e089df2c3 (diff)
downloadminecraft-server-tools-c94132808d2a3499f19f86424bfdedf9e0c39312.tar.gz
testing backups
hid some messages behind VERBOSE option unified date formats of tars
Diffstat (limited to 'backends/bup.sh')
-rw-r--r--backends/bup.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/backends/bup.sh b/backends/bup.sh
index b57bd86..50c2b86 100644
--- a/backends/bup.sh
+++ b/backends/bup.sh
@@ -15,14 +15,14 @@ function bup_init() {
bup -d "$(bup_local)" index "$WORLD_NAME"
local status=$?
if [ $status -ne 0 ]; then
- echo "bup: no local repo found, creating..."
+ echo_debug "bup: no local repo found, creating..."
bup -d "$(bup_local)" init -r "$(bup_local)"
- echo "bup: created local repo at $(bup_local)"
+ echo_debug "bup: created local repo at $(bup_local)"
fi
}
function bup_create_backup() {
- echo "bup: backup started"
+ echo_debug "bup: backup started"
bup -d "$(bup_local)" index "$WORLD_NAME"
@@ -31,16 +31,17 @@ function bup_create_backup() {
local retcode=1
for backup_dir in ${BACKUP_DIRS[*]}
do
- echo "bup: backing up to \"$backup_dir\""
+ echo_debug "bup: backing up to \"$backup_dir\""
# try to save to remote
bup -d "$(bup_local)" save -r "$backup_dir" -n "$BACKUP_NAME" "$WORLD_NAME"
local status=$?
# if failed - reinit remote and try again
if [ $status -ne 0 ]; then
- echo "bup: failed backing up to \"$backup_dir\", reinitializing remote..."
+ echo_debug "bup: failed backing up to \"$backup_dir\", reinitializing remote..."
bup -d "$(bup_local)" init -r "$backup_dir"
- if [ $? -ne 0 ]; then
- echo "bup: created remote at \"$backup_dir\""
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo_debug "bup: created remote at \"$backup_dir\""
bup -d "$(bup_local)" save -r "$backup_dir" -n "$BACKUP_NAME" "$WORLD_NAME"
else
echo "bup: failed to make remote at \"$backup_dir\", moving on"
@@ -73,5 +74,6 @@ function bup_ls_all() {
function bup_restore() {
local remote="$1"
local snapshot="$2"
- bup -d "$(bup_local)" restore -r "$remote" "$BACKUP_NAME/$snapshot/$PWD/."
+ local dest="$3"
+ bup -d "$(bup_local)" restore -r "$remote" --outdir "$dest" "$BACKUP_NAME/$snapshot/$PWD/."
}