diff --git a/Dockerfile b/Dockerfile index 0693edf..64bc241 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,7 @@ RUN easy-add --var version=0.5.0 --var app=mc-monitor --file {{.app}} --from htt COPY *.sh /opt/ COPY property-definitions.json /etc/bds-property-definitions.json +COPY bin/* /usr/local/bin/ # Available versions listed at # https://minecraft.gamepedia.com/Bedrock_Edition_1.11.0 diff --git a/README.md b/README.md index e6588f3..e3d159c 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,15 @@ For more information about managing Bedrock Dedicated Servers in general, [check ## Executing server commands -Assuming you started container with stdin and tty enabled (such as using `-it`), you can attach to the container's console by its name or ID using: +This image comes bundled with a script called `send-command` that will send a Bedrock command and argument to the Bedrock server console. The output of the command only be visible in the container logs. + +For example: + +``` +docker exec CONTAINER_NAME_OR_ID send-command gamerule dofiretick false +``` + +Alternatively, with stdin and tty enabled (such as using `-it`), attach to the container's console by its name or ID using: ```shell script docker attach CONTAINER_NAME_OR_ID @@ -199,7 +207,7 @@ docker attach CONTAINER_NAME_OR_ID While attached, you can execute any server-side commands, such as op'ing your player to be admin: ``` -op YOUR_XBOX_USERNAME +gamerule dofiretick false ``` When finished, detach from the server console using Ctrl-p, Ctrl-q diff --git a/bin/send-command b/bin/send-command new file mode 100755 index 0000000..b37bf4e --- /dev/null +++ b/bin/send-command @@ -0,0 +1,16 @@ +#!/bin/bash + +if [[ $* ]]; then + if proc=$(find /proc -mindepth 2 -maxdepth 2 -name exe -lname '/data/bedrock_server-*' -printf '%h' -quit); then + if [[ $proc ]]; then + echo "$@" > "$proc/fd/0" + else + echo "ERROR: unable to find bedrock server process" + exit 2 + fi + else + echo "ERROR: failed to search for bedrock server process" + exit 2 + fi +fi +