Last active
December 30, 2022 02:25
-
-
Save BarronKane/7dfcd5b3b805bf72e6d47f5a916512f2 to your computer and use it in GitHub Desktop.
A minecraft server start script that syncs worlds between server installs. Works between windows/linux/mac/etc, but if on windows, the windows server must be the main as it can't read linux/osx partitions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
world=<world-name> | |
main=<main server install> | |
new=<new server install> | |
mkdir -p "${main}/bak" | |
mkdir -p "${new}/bak" | |
if [ ! -d "${new}/${world}" ] | |
then | |
cp -R "${main}/${world}" "${new}/${world}" | |
mv "${main}/${world}" "${main}/bak/${world}-$(date +%Y%m%d%H%M%S)" | |
else | |
read -p "CHECK WORLD" -n1 -s | |
break | |
fi | |
if ! grep -q "eula=true" eula.txt; then | |
echo "Do you agree to the Mojang EULA available at https://account.mojang.com/documents/minecraft_eula ?" | |
read -N 1 -p "[y/n] " EULA | |
if [ "$EULA" = "y" ]; then | |
echo "eula=true" > eula.txt | |
echo | |
fi | |
fi | |
"jre/jdk8u312-b07-jre/bin/java" -javaagent:log4jfix/Log4jPatcher-1.0.0.jar -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -Xmx4096M -Xms4096M -jar forge-1.12.2-14.23.5.2855.jar nogui | |
cp -R "${new}/${world}" "${main}/${world}" | |
mv "${new}/${world}" "${new}/bak/${world}-$(date +%Y%m%d%H%M%S)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment