spigot-docker/context/run-server

20 lines
620 B
Text
Raw Normal View History

2025-08-10 11:49:56 -06:00
#!/bin/sh
2025-08-10 13:10:31 -06:00
# add environment variables to motd
export MC_MOTD=$(echo $MC_MOTD | envsubst)
2025-08-10 11:49:56 -06:00
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
}
2025-08-10 11:49:56 -06:00
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
2025-08-10 11:49:56 -06:00
# wait twice in the event sigint (docker stop) is received
wait; wait