#!/bin/sh 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-VERSION.jar nogui & trap "cleanup" INT # wait twice in the event sigint (docker stop) is received wait; wait