Skip to content

Instantly share code, notes, and snippets.

@ConoHa
Last active August 7, 2018 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConoHa/28b5ed749c9eb698481e44946080cd3a to your computer and use it in GitHub Desktop.
Save ConoHa/28b5ed749c9eb698481e44946080cd3a to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
readonly MINECRAFT_DIR="/opt/minecraft_server"
readonly MINECRAFT_SERVICE="/etc/systemd/system/minecraft-server.service"
systemctl disable --now minecraft-server
rm -rf ${MINECRAFT_DIR}/[^backup]*
readonly backup_dir=$(ls ${MINECRAFT_DIR}/backup|grep 1.12.2|sort -r|head -n 1)
cp -r ${MINECRAFT_DIR}/backup/${backup_dir}/* ${MINECRAFT_DIR}
mv -f ${MINECRAFT_DIR}/minecraft-server.service ${MINECRAFT_SERVICE}
chown root:root -R ${MINECRAFT_DIR}
systemctl daemon-reload
systemctl enable --now minecraft-server
echo "Version down finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment