Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,20 @@ To enable the JVM flags required to fully support the [Flare profiling suite](ht

Flare is built-in to Airplane/Pufferfish/Purpur, and is available in [plugin form](https://github.com/TECHNOVE/FlarePlugin) for other server types.

### Enable timestamps in init logs

Before the container starts the Minecraft Server its output is prefixed with `[init]`, such as

```
[init] Starting the Minecraft server...
```

To also include the timestamp with each log, set `LOG_TIMESTAMP` to "true". The log output will then look like:

```
[init] 2022-02-05 16:58:33+00:00 Starting the Minecraft server...
```

## Autopause

### Description
Expand Down
18 changes: 17 additions & 1 deletion scripts/start-utils
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function getFilenameFromUrl() {
}

function isTrue() {
local oldState
oldState=$(shopt -po xtrace)
shopt -u -o xtrace

local value=${1,,}

result=
Expand All @@ -53,6 +57,7 @@ function isTrue() {
;;
esac

eval "$oldState"
return ${result}
}

Expand Down Expand Up @@ -82,7 +87,18 @@ function logn() {
}

function log() {
echo "[init] $*"
local oldState
# The return status when listing options is zero if all optnames are enabled, non- zero otherwise.
oldState=$(shopt -po xtrace || true)
shopt -u -o xtrace

if isDebugging || isTrue "${LOG_TIMESTAMP:-false}"; then
ts=" $(date --rfc-3339=seconds)"
else
ts=
fi
echo "[init]${ts} $*"
eval "$oldState"
}

function logAutopause() {
Expand Down