Skip to content

Instantly share code, notes, and snippets.

@Antrikshy
Created June 28, 2014 02:21
Show Gist options
  • Save Antrikshy/0d76ed597088a0f7f8bb to your computer and use it in GitHub Desktop.
Save Antrikshy/0d76ed597088a0f7f8bb to your computer and use it in GitHub Desktop.
Makes it easy to switch Bukkit/SpigotMC Minecraft server worlds. We have two worlds on our Raspberry Pi and switching requires backing up one world and moving the other out of backup. This automates the process and also runs the server afterwards (can also run current world using "run" argument).
#!/bin/bash
if [ $# -ne 2 ]
then
if [ "$1" != "run" ]
then
echo "Usage: $0 <world to backup> <world to unpack>"
echo "For best results, run with sudo."
exit
else
java -Xms256M -Xmx496M -jar -XX:MaxPermSize=128M /home/pi/SpigotMC/spigot.jar nogui
fi
fi
mkdir -p "$1_Backup"
mv "$1_the_end" "$1_nether" "$1" "server.properties" "$1_Backup"
if [ ! -d "$2_Backup/" ]
then
echo "Your other world should already be in ./$2_Backup"
exit
fi
mv "$2_Backup/"* "."
java -Xms256M -Xmx496M -jar -XX:MaxPermSize=128M /home/pi/SpigotMC/spigot.jar nogui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment