Skip to content

Instantly share code, notes, and snippets.

@kurone-kito
Created March 1, 2021 04:51
Show Gist options
  • Save kurone-kito/44cd4d8aa39f8dfa40b99ff6f86b5354 to your computer and use it in GitHub Desktop.
Save kurone-kito/44cd4d8aa39f8dfa40b99ff6f86b5354 to your computer and use it in GitHub Desktop.
A script to download the Minecraft world from the ScalaCube server for preview it in single play mode.
#!/bin/sh
# vim: set ft=sh:
set -eu
HOST=minecraft-scalacube.example.com
USER=backup
PORT=2017
SRC_ZIP=$(ssh -p ${PORT} ${USER}@${HOST} 'ls -t minecraft-2* | head -1')
DST_ZIP=$(mktemp -u).zip
SRC_PATH=$(mktemp -d)
DST_PATH=~/Library/Application\ Support/minecraft/saves
WORLD_NAME=kito
scp -P ${PORT} ${USER}@${HOST}:./${SRC_ZIP} "${DST_ZIP}"
unzip -q "${DST_ZIP}" -d "${SRC_PATH}"
rm -rf "${DST_PATH}/${WORLD_NAME}"
mv "${SRC_PATH}/${WORLD_NAME}" "${DST_PATH}"
rm -rf "${DST_ZIP}" "${SRC_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment