-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
234 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@echo off | ||
|
||
call settings.bat | ||
|
||
:install_files | ||
echo Installing Forge and required jars. | ||
java -jar %INSTALL_JAR% --installServer > NUL 2>&1 | ||
echo Done! | ||
exit /B | ||
|
||
goto install_files |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# Read the settings. | ||
. ./settings.sh | ||
|
||
install_files() { | ||
java -jar ${INSTALL_JAR} --installServer > /dev/null 2>&1 | ||
} | ||
|
||
echo "Installing Forge and required jars." | ||
install_files | ||
echo "Done!" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1. Please Forge download for forge-1.7.10-10.13.4.1614-1.7.10-installer.jar | ||
2. Edit settings.bat or settings.sh | ||
3. Start Install.bat or Install.sh | ||
4. ServerStart.bat or ServerStart.sh push | ||
5. Enjoy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@echo off | ||
|
||
call settings.bat | ||
|
||
:start_server | ||
echo Starting GregTech Expert Server... | ||
java -server -Xms%MIN_RAM% -Xmx%MAX_RAM% -XX:MaxMetaspaceSize=%MAX_MetaspaceSize% %JAVA_PARAMETERS% -jar %SERVER_JAR% -XX:OnOutOfMemoryError="kill -9 %p" nogui | ||
pause | ||
exit /B | ||
|
||
goto start_server |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# Read the settings. | ||
. ./settings.sh | ||
|
||
# Start the server. | ||
start_server() { | ||
java -server -Xms${MIN_RAM} -Xmx${MAX_RAM} -XX:MaxMetaspaceSize=${Max_MetaspaceSize} ${JAVA_PARAMETERS} -XX:OnOutOfMemoryError="kill -9 %p" -jar ${SERVER_JAR} nogui | ||
} | ||
|
||
echo "Starting Starting GregTech Expert Server..." | ||
start_server |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#!/bin/bash | ||
# Minecraft service that starts the server in a tmux session. | ||
# https://github.com/tier940/minecraft-tmux | ||
|
||
JAVA_PATH="/usr/lib/jvm/java-8-openjdk/bin/java" | ||
TMUX_SOCKET="steam" | ||
TMUX_SESSION="gte" | ||
MC_HOME="/home/minecraft/gte/" | ||
MC_JAR_FILE="forge-1.12.2-14.23.5.2860.jar" | ||
MC_MIN_RAM="2G" | ||
MC_MAX_RAM="8G" | ||
MC_JVM_PARAMETERS="-XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -XX:InitiatingHeapOccupancyPercent=20 -Dlog4j.configurationFile=log4j2_112-116.xml" | ||
|
||
is_server_running() { | ||
/usr/bin/tmux -L ${TMUX_SOCKET} has-session -t ${TMUX_SESSION} > /dev/null 2>&1 | ||
return ${?} | ||
} | ||
|
||
mc_command() { | ||
cmd="$1" | ||
/usr/bin/tmux -L ${TMUX_SOCKET} send-keys -t ${TMUX_SESSION}.0 "$cmd" ENTER | ||
return ${?} | ||
} | ||
|
||
start_server() { | ||
if is_server_running; then | ||
echo "Server already running" | ||
return 1 | ||
else | ||
echo "Starting minecraft server in tmux session" | ||
/usr/bin/tmux -L ${TMUX_SOCKET} new-session -c ${MC_HOME} -s ${TMUX_SESSION} -d ${JAVA_PATH} -Xms${MC_MIN_RAM} -Xmx${MC_MAX_RAM} ${MC_JVM_PARAMETERS} -jar ${MC_HOME}$MC_JAR_FILE | ||
return ${?} | ||
fi | ||
} | ||
|
||
stop_server() { | ||
if ! is_server_running; then | ||
echo "Server is not running!" | ||
return 1 | ||
else | ||
# Warn players | ||
echo "Warning players" | ||
mc_command "title @a times 3 14 3" | ||
for i in {60..1}; do | ||
mc_command "title @a subtitle {\"text\":\"in ${i} seconds\",\"color\":\"gray\"}" | ||
mc_command "title @a title {\"text\":\"Shutting down\",\"color\":\"dark_red\"}" | ||
echo "Server stop in ${i} seconds" | ||
sleep 1 | ||
done | ||
|
||
# Issue shutdown | ||
echo "Save all" | ||
mc_command "save-all" | ||
sleep 0 | ||
echo "Stopping server" | ||
mc_command "stop" | ||
if [[ ${?} -ne 0 ]]; then | ||
echo "Failed to send stop command to server" | ||
return 1 | ||
fi | ||
|
||
# Wait for server to stop | ||
wait=0 | ||
while is_server_running; do | ||
sleep 1 | ||
|
||
wait=$((wait+1)) | ||
if [ ${wait} -gt 90 ]; then | ||
echo "Could not stop server, timeout" | ||
return 1 | ||
fi | ||
done | ||
return 0 | ||
fi | ||
} | ||
|
||
restart_server() { | ||
if ! is_server_running; then | ||
echo "Server is not running!" | ||
return 1 | ||
else | ||
if stop_server; then | ||
start_server | ||
return ${?} | ||
else | ||
echo "Failed server restart" | ||
return 1 | ||
fi | ||
fi | ||
} | ||
|
||
reload_server() { | ||
/usr/bin/tmux -L ${TMUX_SOCKET} send-keys -t ${TMUX_SESSION}.0 "reload" ENTER | ||
return ${?} | ||
} | ||
|
||
attach_session() { | ||
if ! is_server_running; then | ||
echo "Cannot attach to server session, server not running" | ||
return ${?} | ||
else | ||
/usr/bin/tmux -L ${TMUX_SOCKET} attach-session -t ${TMUX_SESSION} | ||
return 0 | ||
fi | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start_server | ||
attach_session | ||
exit ${?} | ||
;; | ||
stop) | ||
stop_server | ||
exit ${?} | ||
;; | ||
restart) | ||
restart_server | ||
exit ${?} | ||
;; | ||
reload) | ||
reload_server | ||
exit ${?} | ||
;; | ||
attach) | ||
attach_session | ||
exit ${?} | ||
;; | ||
*) | ||
echo "Usage: ${0} {start|stop|restart|reload|attach}" | ||
exit 2 | ||
;; | ||
esac |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
REM Don't edit these values unless you know what you are doing. | ||
set INSTALL_JAR=forge-1.7.10-10.13.4.1614-1.7.10-installer.jar | ||
set SERVER_JAR=forge-1.7.10-10.13.4.1614-1.7.10-universal.jar | ||
|
||
REM You can edit these values if you wish. | ||
set MIN_RAM=1024M | ||
set MAX_RAM=4096M | ||
set MAX_MetaspaceSize=512M | ||
set JAVA_PARAMETERS=-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=10 -Djava.net.preferIPv4Stack=true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Don't edit these values unless you know what you are doing. | ||
export INSTALL_JAR="forge-1.7.10-10.13.4.1614-1.7.10-installer.jar" | ||
export SERVER_JAR="forge-1.7.10-10.13.4.1614-1.7.10-universal.jar" | ||
|
||
# You can edit these values if you wish. | ||
export MIN_RAM="1024M" | ||
export MAX_RAM="4096M" | ||
export Max_MetaspaceSize="512M" | ||
export JAVA_PARAMETERS="-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=10 -Djava.net.preferIPv4Stack=true" |