Skip to content

Instantly share code, notes, and snippets.

@bennet0496
Last active April 8, 2017 17:45
Show Gist options
  • Save bennet0496/21ec09d268c174db6820c9b75b4ce6eb to your computer and use it in GitHub Desktop.
Save bennet0496/21ec09d268c174db6820c9b75b4ce6eb to your computer and use it in GitHub Desktop.
Minecraft Startscript [TMUX] (ByteGaming Tutorial) https://www.bytegaming.de/?p=396
#!/bin/bash
#CHANGE ME!!!!!!!!!!!!!
ASUSER=minecraft
asuser(){
if [ "`whoami`" = "$ASUSER" ]; then
/bin/bash -c "$@"
else
/bin/su -ml $ASUSER -c "$@"
fi
}
#CHANGE ME!!!!!!!!!!!!!
cd /path/to/minecraft/server
case $1 in
start)
asuser "tmux new -s minecraft -d java -jar minecraft_server.jar nogui"
;;
stop)
asuser "tmux send-keys -t minecraft '/stop' C-m"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment