Last active
August 29, 2015 14:25
-
-
Save PetrGlad/a700b210b675deed81a6 to your computer and use it in GitHub Desktop.
Minecraft on Raspberry Pi
This file contains hidden or 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 | |
# Use this to attach to running server and issue admin commands | |
tmux attach -t minecraft |
This file contains hidden or 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 | |
PIDFILE=$HOME/.mc-tunnel.pid | |
if [ -f $PIDFILE ] | |
then | |
echo "Closing." | |
cat $PIDFILE | xargs kill | |
rm $PIDFILE | |
else | |
echo "Already closed. (No $PIDFILE)" | |
fi |
This file contains hidden or 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 | |
# Use remote relay host to listen from behind NAT | |
PIDFILE=$HOME/.mc-tunnel.pid | |
if [ -f $PIDFILE ] | |
then | |
echo "RM tunnel is already open. ($PIDFILE exists)" | |
else | |
echo "Opening RM tunnel" | |
ssh -N -R 0.0.0.0:25565:localhost:25565 minecraft@a-host-with-public-ip & | |
echo $! > $PIDFILE | |
fi |
This file contains hidden or 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
# Require: Java 8 (older ones perform significantly worse); git; ssh; tmux | |
# Install spigot - Modified MC server based on Bukkit | |
# See https://www.spigotmc.org/ | |
# Building locally: download latest BuildTools.jar from https://hub.spigotmc.org/jenkins/job/BuildTools/ | |
java -jar BuildTools.jar | |
This file contains hidden or 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 | |
# MC Server gets commands from stdio so we just wrap it into tmux session | |
# Adjust spigot*.jar name according to latest version | |
MC_CMD="java -Xmx512M -Xms128M -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -jar spigot-1.8.7.jar nogui" | |
MC_HOME="/home/pi/minecraft-server/" # Server JAR should be located here | |
if [ `tmux list-sessions | grep minecraft | wc -l` == 1 ] | |
then | |
echo "Minecraft session already exists." | |
else | |
echo "Launcing minecraft session" | |
cd $MC_HOME | |
tmux new-session -s minecraft -d "$MC_CMD" | |
fi | |
# You can start this remotely with ssh pi@raspberrypi-host ./start-minecraft |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment