Skip to content

Commit ab51be2

Browse files
authored
Bundle send-command script (#296)
1 parent 8ada363 commit ab51be2

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ RUN easy-add --var version=0.5.0 --var app=mc-monitor --file {{.app}} --from htt
4848
COPY *.sh /opt/
4949

5050
COPY property-definitions.json /etc/bds-property-definitions.json
51+
COPY bin/* /usr/local/bin/
5152

5253
# Available versions listed at
5354
# https://minecraft.gamepedia.com/Bedrock_Edition_1.11.0

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,15 @@ For more information about managing Bedrock Dedicated Servers in general, [check
190190
191191
## Executing server commands
192192
193-
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:
193+
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.
194+
195+
For example:
196+
197+
```
198+
docker exec CONTAINER_NAME_OR_ID send-command gamerule dofiretick false
199+
```
200+
201+
Alternatively, with stdin and tty enabled (such as using `-it`), attach to the container's console by its name or ID using:
194202
195203
```shell script
196204
docker attach CONTAINER_NAME_OR_ID
@@ -199,7 +207,7 @@ docker attach CONTAINER_NAME_OR_ID
199207
While attached, you can execute any server-side commands, such as op'ing your player to be admin:
200208

201209
```
202-
op YOUR_XBOX_USERNAME
210+
gamerule dofiretick false
203211
```
204212

205213
When finished, detach from the server console using Ctrl-p, Ctrl-q

bin/send-command

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [[ $* ]]; then
4+
if proc=$(find /proc -mindepth 2 -maxdepth 2 -name exe -lname '/data/bedrock_server-*' -printf '%h' -quit); then
5+
if [[ $proc ]]; then
6+
echo "$@" > "$proc/fd/0"
7+
else
8+
echo "ERROR: unable to find bedrock server process"
9+
exit 2
10+
fi
11+
else
12+
echo "ERROR: failed to search for bedrock server process"
13+
exit 2
14+
fi
15+
fi
16+

0 commit comments

Comments
 (0)