From d3c559fa0061a26963e0daeee6261331f77dda19 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 28 Dec 2019 17:33:17 -0500 Subject: [PATCH] Moved server run scripts --- core/src/mindustry/net/Administration.java | 2 +- core/src/mindustry/net/BeControl.java | 2 +- server/run-jar | 19 +++++++++++++++++++ run-server => server/run-server | 11 ++++++++++- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100755 server/run-jar rename run-server => server/run-server (81%) diff --git a/core/src/mindustry/net/Administration.java b/core/src/mindustry/net/Administration.java index 157566a5c3..268e8d089f 100644 --- a/core/src/mindustry/net/Administration.java +++ b/core/src/mindustry/net/Administration.java @@ -319,7 +319,7 @@ public class Administration{ public enum Config{ name("The server name as displayed on clients.", "Server", "servername"), port("The port to host on.", Vars.port), - autoUpdate("Whether to auto-restart when a new update arrives.", false), + autoUpdate("Whether to auto-update and exit when a new bleeding-edge update arrives.", false), crashReport("Whether to send crash reports.", false, "crashreport"), logging("Whether to log everything to files.", true), strict("Whether strict mode is on - corrects positions and prevents duplicate UUIDs.", true), diff --git a/core/src/mindustry/net/BeControl.java b/core/src/mindustry/net/BeControl.java index 4de581108f..bce61a1663 100644 --- a/core/src/mindustry/net/BeControl.java +++ b/core/src/mindustry/net/BeControl.java @@ -126,7 +126,7 @@ public class BeControl{ progress -> {}, () -> false, () -> { - Log.info("&lcVersion downloaded, exiting. Note that if you are not using the run-server script, the server will not restart automatically."); + Log.info("&lcVersion downloaded, exiting. Note that if you are not using a auto-restart script, the server will not restart automatically."); //replace old file with new dest.copyTo(source); dest.delete(); diff --git a/server/run-jar b/server/run-jar new file mode 100755 index 0000000000..2ab341566f --- /dev/null +++ b/server/run-jar @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +if [[ $# -eq 0 ]] ; then + echo 'A server jar must be supplied as the first argument.' + exit 1 +fi + +if [[ ! -e $1 ]] ; then + echo "The supplied jar file '$1' must exist." + exit 1 +fi + +while true; do +#auto-restart until ctrl-c or exit 0 +java -jar -XX:+HeapDumpOnOutOfMemoryError $1 +excode=$? +if [ $excode -eq 0 ] || [ $excode -eq 130 ]; then + exit 0 +fi +done diff --git a/run-server b/server/run-server similarity index 81% rename from run-server rename to server/run-server index 25a8254723..4e337686a0 100755 --- a/run-server +++ b/server/run-server @@ -4,13 +4,22 @@ if [[ $# -eq 0 ]] ; then exit 1 fi +cd .. + ./gradlew server:dist -Pbuildversion=$1 +excode=$? + +if [ $excode -ne 0 ]; then + echo $excode + exit 1 +fi + while true; do #auto-restart until ctrl-c or exit 0 java -jar -XX:+HeapDumpOnOutOfMemoryError server/build/libs/server-release.jar excode=$? if [ $excode -eq 0 ] || [ $excode -eq 130 ]; then - exit 0 + exit 0 fi done