Skip to content

Instantly share code, notes, and snippets.

@gamerlv
Created August 23, 2015 20:56
Show Gist options
  • Save gamerlv/499f9bb31522af566d38 to your computer and use it in GitHub Desktop.
Save gamerlv/499f9bb31522af566d38 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Call like: startServer.sh jarfile minmem maxmem serverdir
# EG: startServer.sh /path/to/file.jar 1024 4096 /path/to/multicraft/server1234
# mulicraft conf: startServer.sh {JAR} {START_MEMORY} {MAX_MEMORY} {SERVER_DIR}
START_MEMORY=$2;
MAX_MEMORY=$3;
JAR=$1;
SERVER_DIR=$4;
SERVER_ID=${$SERVER_DIR#server};
PROPFILE="server.properties";
if ! grep -q "ID=${SERVER_ID}" "$PROPFILE"; then
echo "ID=${SERVER_ID}" >> $PROPFILE;
fi
/usr/bin/java -Xmx${MAX_MEMORY}M -Xms${START_MEMORY}M -XX:MaxPermSize=128M -Djline.terminal=jline.UnsupportedTerminal -jar "${JAR}" nogui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment