add cleanup function, server memory variable
This commit is contained in:
parent
9c87494776
commit
878c146203
2 changed files with 13 additions and 7 deletions
|
@ -1,14 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
export TERM=xterm-256color
|
||||
cd /spigot
|
||||
cleanup() {
|
||||
rcon -m -p 25575 --host localhost --password "${MC_RCON_PASSWORD}" say Warning! Server is shutting down in 5 seconds...
|
||||
sleep 5
|
||||
rcon -m -p 25575 --host localhost --password "${MC_RCON_PASSWORD}" stop
|
||||
}
|
||||
|
||||
cd /server
|
||||
envsubst < /spigot/server.properties.in > /server/server.properties
|
||||
[ "$ACCEPT_EULA" = "true" ] && echo eula=true > /server/eula.txt
|
||||
java -Xmx6G -jar /spigot/spigot-VERSION.jar nogui &
|
||||
JAVA_PID=$!
|
||||
|
||||
trap "rcon -m -p 25575 --host localhost --password '${MC_RCON_PASSWORD}' stop" INT
|
||||
java -Xmx${SERVER_MEMORY:-6G} -jar /spigot/spigot-VERSION.jar nogui &
|
||||
trap "cleanup" INT
|
||||
|
||||
wait
|
||||
wait
|
||||
# wait twice in the event sigint (docker stop) is received
|
||||
wait; wait
|
||||
|
|
|
@ -13,7 +13,10 @@ services:
|
|||
ports:
|
||||
- 25565:25565
|
||||
environment:
|
||||
# Entrypoint variables
|
||||
- "ACCEPT_EULA=false"
|
||||
- "SERVER_MEMORY=6G"
|
||||
# server.properties Values
|
||||
- "MC_ACCEPTS_TRANSFERS=false"
|
||||
- "MC_ALLOW_FLIGHT=false"
|
||||
- "MC_ALLOW_NETHER=true"
|
||||
|
|
Loading…
Add table
Reference in a new issue