mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-13 23:57:08 +00:00
42 lines
1.1 KiB
Bash
Executable file
42 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# shellcheck source=start-utils
|
|
. "${SCRIPTS:-/}start-utils"
|
|
|
|
: "${SERVER_PORT:=25565}"
|
|
: "${ENABLE_AUTOSTOP:=false}"
|
|
: "${AUTOSTOP_TIMEOUT_EST:=3600}"
|
|
: "${AUTOSTOP_TIMEOUT_INIT:=1800}"
|
|
: "${AUTOSTOP_PERIOD:=10}"
|
|
export SERVER_PORT
|
|
export ENABLE_AUTOSTOP
|
|
export AUTOSTOP_TIMEOUT_EST
|
|
export AUTOSTOP_TIMEOUT_INIT
|
|
export AUTOSTOP_PERIOD
|
|
|
|
log "Autostop functionality enabled"
|
|
|
|
isDebugging && set -x
|
|
|
|
if ! [[ $AUTOSTOP_PERIOD =~ ^[0-9]+$ ]]; then
|
|
AUTOSTOP_PERIOD=10
|
|
export AUTOSTOP_PERIOD
|
|
log "Warning: AUTOSTOP_PERIOD is not numeric, set to 10 (seconds)"
|
|
fi
|
|
if [ "$AUTOSTOP_PERIOD" -eq "0" ] ; then
|
|
AUTOSTOP_PERIOD=10
|
|
export AUTOSTOP_PERIOD
|
|
log "Warning: AUTOSTOP_PERIOD must not be 0, set to 10 (seconds)"
|
|
fi
|
|
if ! [[ $AUTOSTOP_TIMEOUT_EST =~ ^[0-9]+$ ]] ; then
|
|
AUTOSTOP_TIMEOUT_EST=3600
|
|
export AUTOSTOP_TIMEOUT_EST
|
|
log "Warning: AUTOSTOP_TIMEOUT_EST is not numeric, set to 3600 (seconds)"
|
|
fi
|
|
if ! [[ $AUTOSTOP_TIMEOUT_INIT =~ ^[0-9]+$ ]] ; then
|
|
AUTOSTOP_TIMEOUT_INIT=1800
|
|
export AUTOSTOP_TIMEOUT_INIT
|
|
log "Warning: AUTOSTOP_TIMEOUT_INIT is not numeric, set to 1800 (seconds)"
|
|
fi
|
|
|
|
/autostop/autostop-daemon.sh &
|