Skip to content

Commit

Permalink
Update chat messages for restic
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaschan committed Jun 15, 2021
1 parent 3db3959 commit e5eb486
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/data/test-chat-messages.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/data/test-chat-prefix.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit e5eb486

Please sign in to comment.