Add basic server idle checking, sleep server if idle for specified time

This commit is contained in:
timvisee
2021-11-08 14:19:52 +01:00
parent 049fce78b7
commit fed541c893
5 changed files with 120 additions and 13 deletions

20
res/start-server Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Server file
FILE=server.jar
# Switch to script directory
DIR="$(dirname "$(realpath "$0")")"
cd $DIR
# Catch SIGTERM to gracefully stop server
trap 'kill -TERM $PID' TERM INT
# Start server
java -Xms1G -Xmx1G -jar $FILE --nogui &
# Clean up stopped server
PID=$!
wait $PID
trap - TERM INT
wait $PID