diff --git a/backup.sh b/backup.sh index 5778e51..f3dc8e2 100755 --- a/backup.sh +++ b/backup.sh @@ -240,8 +240,13 @@ if $MISSING_CONFIGURATION; then exit 1 fi -ARCHIVE_FILE_NAME="$TIMESTAMP.tar$COMPRESSION_FILE_EXTENSION" -ARCHIVE_PATH="$BACKUP_DIRECTORY/$ARCHIVE_FILE_NAME" +if [[ "$BACKUP_DIRECTORY" != "" ]]; then + ARCHIVE_FILE_NAME="$TIMESTAMP.tar$COMPRESSION_FILE_EXTENSION" + ARCHIVE_PATH="$BACKUP_DIRECTORY/$ARCHIVE_FILE_NAME" +fi +if [[ "$RESTIC_REPO" != "" ]]; then + ARCHIVE_PATH="$RESTIC_REPO $TIMESTAMP" +fi # Minecraft server screen interface functions message-players () { @@ -478,7 +483,7 @@ trap "clean-up" 2 do-backup () { # Notify players of start - message-players "Starting backup..." "$ARCHIVE_FILE_NAME" + message-players "Starting backup..." "$ARCHIVE_PATH" # Disable world autosaving execute-command "save-off" diff --git a/test/data/test-chat-messages.txt b/test/data/test-chat-messages.txt index 74efae3..65aaeb4 100644 --- a/test/data/test-chat-messages.txt +++ b/test/data/test-chat-messages.txt @@ -1,4 +1,4 @@ -tellraw @a ["",{"text":"[Backup] ","color":"gray","italic":true},{"text":"Starting backup...","color":"gray","italic":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"2021-01-01_00-00-00.tar.gz"}]}}}] +tellraw @a ["",{"text":"[Backup] ","color":"gray","italic":true},{"text":"Starting backup...","color":"gray","italic":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"test/tmp/backups/2021-01-01_00-00-00.tar.gz"}]}}}] save-off save-on save-all diff --git a/test/data/test-chat-prefix.txt b/test/data/test-chat-prefix.txt index 88346f7..33d6856 100644 --- a/test/data/test-chat-prefix.txt +++ b/test/data/test-chat-prefix.txt @@ -1,4 +1,4 @@ -tellraw @a ["",{"text":"[Hello] ","color":"gray","italic":true},{"text":"Starting backup...","color":"gray","italic":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"2021-01-01_00-00-00.tar.gz"}]}}}] +tellraw @a ["",{"text":"[Hello] ","color":"gray","italic":true},{"text":"Starting backup...","color":"gray","italic":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"test/tmp/backups/2021-01-01_00-00-00.tar.gz"}]}}}] save-off save-on save-all