Moved server run scripts

This commit is contained in:
Anuken 2019-12-28 17:33:17 -05:00
parent 179bf4d525
commit d3c559fa00
4 changed files with 31 additions and 3 deletions

View File

@ -319,7 +319,7 @@ public class Administration{
public enum Config{ public enum Config{
name("The server name as displayed on clients.", "Server", "servername"), name("The server name as displayed on clients.", "Server", "servername"),
port("The port to host on.", Vars.port), 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"), crashReport("Whether to send crash reports.", false, "crashreport"),
logging("Whether to log everything to files.", true), logging("Whether to log everything to files.", true),
strict("Whether strict mode is on - corrects positions and prevents duplicate UUIDs.", true), strict("Whether strict mode is on - corrects positions and prevents duplicate UUIDs.", true),

View File

@ -126,7 +126,7 @@ public class BeControl{
progress -> {}, progress -> {},
() -> false, () -> 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 //replace old file with new
dest.copyTo(source); dest.copyTo(source);
dest.delete(); dest.delete();

19
server/run-jar Executable file
View File

@ -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

View File

@ -4,13 +4,22 @@ if [[ $# -eq 0 ]] ; then
exit 1 exit 1
fi fi
cd ..
./gradlew server:dist -Pbuildversion=$1 ./gradlew server:dist -Pbuildversion=$1
excode=$?
if [ $excode -ne 0 ]; then
echo $excode
exit 1
fi
while true; do while true; do
#auto-restart until ctrl-c or exit 0 #auto-restart until ctrl-c or exit 0
java -jar -XX:+HeapDumpOnOutOfMemoryError server/build/libs/server-release.jar java -jar -XX:+HeapDumpOnOutOfMemoryError server/build/libs/server-release.jar
excode=$? excode=$?
if [ $excode -eq 0 ] || [ $excode -eq 130 ]; then if [ $excode -eq 0 ] || [ $excode -eq 130 ]; then
exit 0 exit 0
fi fi
done done