spigot-docker/context/run-server
2025-08-10 13:10:31 -06:00

19 lines
620 B
Bash
Executable file

#!/bin/sh
# add environment variables to motd
export MC_MOTD=$(echo $MC_MOTD | envsubst)
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 -Xmx${SERVER_MEMORY:-6G} -jar /spigot/spigot-SED_VERSION.jar nogui &
trap "cleanup" INT
# wait twice in the event sigint (docker stop) is received
wait; wait