Add borg executable bit

This commit is contained in:
Nicolas Chan 2019-08-11 17:55:05 -07:00
parent f005e54965
commit 7d548ce28e
No known key found for this signature in database
GPG key ID: D9864F58F7DAE888

12
backup-borg.sh Normal file → Executable file
View file

@ -2,6 +2,7 @@
# Minecraft server automatic backup management script # Minecraft server automatic backup management script
# by Nicolas Chan # by Nicolas Chan
# https://github.com/nicolaschan/minecraft-backup
# MIT License # MIT License
# #
# For Minecraft servers running in a GNU screen. # For Minecraft servers running in a GNU screen.
@ -133,9 +134,6 @@ message-players-color () {
fi fi
} }
# Notify players of start
message-players "Starting backup..." "$ARCHIVE_FILE_NAME"
# Parse file timestamp to one readable by "date" # Parse file timestamp to one readable by "date"
parse-file-timestamp () { parse-file-timestamp () {
local DATE_STRING=$(echo $1 | awk -F_ '{gsub(/-/,":",$2); print $1" "$2}') local DATE_STRING=$(echo $1 | awk -F_ '{gsub(/-/,":",$2); print $1" "$2}')
@ -243,12 +241,18 @@ delete-old-backups () {
esac esac
} }
# Notify players of start
message-players "Starting backup..." "$ARCHIVE_FILE_NAME"
# Disable world autosaving # Disable world autosaving
execute-command "save-off" execute-command "save-off"
# Backup world # Record start time for performance reporting
START_TIME=$(date +"%s") START_TIME=$(date +"%s")
TMP_WORLD_SAVE_DIR=$(mktemp)
cp -r "$SERVER_WORLD" "$TMP_WORLD_SAVE_DIR"
if $USE_BORG_BACKUP; then if $USE_BORG_BACKUP; then
borg create --compression "$COMPRESSION_ALGORITHM,$COMPRESSION_LEVEL" "$ARCHIVE_PATH" "$SERVER_WORLD" borg create --compression "$COMPRESSION_ALGORITHM,$COMPRESSION_LEVEL" "$ARCHIVE_PATH" "$SERVER_WORLD"
else else